Question 1
OCR Computer Science June 2024 Algorithms and programming (H446-02)A level9 marks
On the specification
- (a)(i)
- 2.2 Problem solving and programming
- (a)(ii)
- 2.2 Problem solving and programming
- (b)
- 2.2 Problem solving and programming
- (c)
- 2.2 Problem solving and programming
Question text
1 A student has written this pseudocode algorithm: 1 a = 12 2 do 3 b = input("Enter a number") 4 until b >= 0 and b <= 100 5 for c = 1 to a 6 print(c * a) 7 next c (a) The program uses variables. (i) Describe what is meant by a variable. [2] (ii) Give the identifiers of all the variables used in this program. [1] (b) The student has used a do loop on line 02. Describe the difference between a do loop and a while loop. [2] (c) Rewrite lines 05 to 07 to use a while loop instead of a for loop. You should write your answer using either program code or pseudocode. [4]