Structured programming and subroutines (procedures and functions)

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142
Question 29
Easy

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]

Structured programming and subroutines (procedures and functions) Questions

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