Loading...

My Learning Pad Login

Welcome

GCSE OCR Computer Science J277 - Topic 2.2.1: Programming Fundamentals Exam

Answers and Explanations

Question 1 (2 marks)

Question 2 (1 mark)

The symbol is .

Question 3 (3 marks)

a) name ← INPUT("Enter name: ") (1 mark)
b) OUTPUT("Hello") (1 mark)
c) score ← 0 (1 mark)

Question 4 (2 marks)

Question 5 (4 marks)

x ← 7  
y ← 3  
sum ← x + y  
OUTPUT(sum)  

(1 mark for assignments, 1 for calculation, 1 for output, 1 for correct sequence.)

Question 6 (5 marks)

age ← INPUT("Enter age: ")  
IF age >= 18 THEN  
    OUTPUT("Adult")  
ELSE  
    OUTPUT("Minor")  
ENDIF  

(1 mark for input, 1 for IF, 1 for condition, 1 for outputs, 1 for ELSE/ENDIF.)

Question 7 (4 marks)

FOR i ← 1 TO 5  
    OUTPUT(i)  
NEXT i  

(1 mark for FOR, 1 for range, 1 for OUTPUT, 1 for NEXT.)

Question 8 (5 marks)

counter ← 0  
WHILE counter < 10 DO  
    OUTPUT(counter)  
    counter ← counter + 2  
ENDWHILE  

(1 mark for initialization, 1 for WHILE, 1 for condition, 1 for OUTPUT/increment, 1 for ENDWHILE.)

Question 9 (3 marks)

a) Arithmetic: Returns the remainder of division. (1 mark)
b) Comparison: Greater than or equal to. (1 mark)
c) Boolean: True if both conditions are true. (1 mark)

Question 10 (4 marks)

result = (5 + 3) * 2 / 4  
print(result)  # Outputs 4.0  

(1 mark for expression, 1 for parentheses, 1 for print, 1 for correct output in comment/explanation.)
Explanation: Addition first (8), multiply by 2 (16), divide by 4 (4.0).

Question 11 (3 marks)

"Remainder 1"
Explanation: 10 MOD 3 = 1 (remainder), so condition is true. (2 marks for explanation, 1 for output.)

Question 12 (5 marks)

num ← INPUT("Enter number: ")  
IF num MOD 2 == 0 THEN  
    OUTPUT("Even")  
ELSE  
    OUTPUT("Odd")  
ENDIF  
FOR i ← 1 TO 3  
    OUTPUT("Check complete")  
NEXT i  

(1 mark for input, 1 for IF/MOD, 1 for outputs, 1 for FOR loop, 1 for overall structure.)

Question 13 (2 marks)

Question 14 (4 marks)

IF score >= 50 AND score <= 100 THEN
(1 mark for >=, 1 for <=, 1 for AND, 1 for structure.)
Explanation: AND ensures both conditions must be true for the range.

Question 15 (3 marks)

Output:
5
4
3
2
1
Explanation: Loop prints num while >0, decrementing by 1 each time. (2 marks for output, 1 for explanation.)