Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
Question 28

State how many times the subroutine DISPENSE_REAGENT will be called with the parameter 'acid' if the user input is 'macro' in Figure 1.

Figure 1

1      volume_type ← USERINPUT
2      IF volume_type = 'micro' THEN
3          aliquots ← 2
4      ELSE IF volume_type = 'standard' THEN
5          aliquots ← 5
6      ELSE IF volume_type = 'macro' THEN
7          aliquots ← 8
8      ELSE
9          OUTPUT 'invalid volume'
10     ENDIF
11     FOR k ← 1 TO aliquots
12         IF k > 3 THEN
13             DISPENSE_REAGENT('acid')
14         ELSE
15             DISPENSE_REAGENT('buffer')
16         ENDIF
17     ENDFOR
[1]
Markscheme

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)

131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.

Question bank