Programming fundamentals
OCR GCSE Computer Science revision on Programming fundamentals. Aligned to the OCR GCSE Computer Science J277 specification. This bank has 9 practice questions on this topic.
Sample questions (3 of 9)
-
Question 1
In Python pseudocode, the operation `x = 7 MOD 3` returns what?
Show answer
Answer: 1
MOD (or %) gives the remainder after integer division. 7 / 3 = 2 with 1 left over → 7 MOD 3 = 1. Very useful for checking evenness (x MOD 2 == 0 means x is even), wrap-around indexing, and digit extraction.
-
Question 2
What is the difference between a variable and a constant?
- A) Constants are integers; variables are strings
- B) Variables can be changed during the program
- C) Constants only work in maths; variables in text
- D) There is no difference
Show answer
Answer: Variables can be changed during the program
Constants are used for values that should never change during execution (PI = 3.14159, VAT_RATE = 0.20). Some languages enforce this (Python's PEP 8 uses ALL_CAPS by convention but doesn't enforce immutability). Variables are the day-to-day boxes that hold values that change.
-
Question 3
In OCR pseudocode, `INPUT name` does what?
- A) Saves the variable name to a file
- B) Reads input from the user and stores it in name
- C) Outputs the name to screen
- D) Prints the literal string 'name'
Show answer
Answer: Reads input from the user and stores it in name
OCR pseudocode uses: INPUT (get user input), PRINT (display output), and assignment ← (or =) to store values. Example: `INPUT age; IF age >= 18 THEN PRINT 'adult' ELSE PRINT 'minor' ENDIF`. Same logical structure as Python or any modern language — just slightly different syntax.
Want to test yourself on the remaining cards for this topic?
6 more questions on Programming fundamentals — plus mistakes tracking and spaced repetition across the whole Computer Science spec.