You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson provides comprehensive exam practice for the Programming Fundamentals topic, covering the key content from OCR J277 Section 2.3 that appears on Paper 2: Computational Thinking, Algorithms and Programming. This lesson brings together all programming concepts: variables, data types, operators, selection, iteration, arrays, strings, subroutines, and file handling.
Paper 2 is worth 80 marks and lasts 1 hour 30 minutes. Programming fundamentals typically accounts for 25–35 marks. Questions will use OCR pseudocode and/or Python.
| Question Type | Typical Marks | What You Need to Do |
|---|---|---|
| Identify data type | 1 mark | Name the data type of a given value |
| Explain a keyword | 1–2 marks | Define a programming term |
| Read and interpret code | 2–4 marks | State the output of given code |
| Complete/fix code | 3–5 marks | Fill in blanks or correct errors |
| Write a program | 4–8 marks | Write a complete solution from a description |
| Explain benefits | 2–3 marks | Justify a programming choice |
OCR Exam Tip: You may answer Paper 2 questions using either OCR pseudocode or Python. Be consistent — do not mix them within a single answer. If you are stronger in Python, use Python throughout.
Question: State the most appropriate data type for each of the following: (a) The number of students in a class (b) Whether a light switch is on or off
Model Answer: (a) Integer — the number of students is always a whole number. (b) Boolean — there are only two possible states: true (on) or false (off).
Question: What are the values of the following expressions?
(a) 27 DIV 5
(b) 27 MOD 5
(c) 100 MOD 7
Model Answer:
(a) 27 DIV 5 = 5 (27 divided by 5 is 5 remainder 2; DIV gives the quotient)
(b) 27 MOD 5 = 2 (27 divided by 5 is 5 remainder 2; MOD gives the remainder)
(c) 100 MOD 7 = 2 (100 = 7 × 14 + 2; the remainder is 2)
Question: Complete a trace table for the following pseudocode:
x = 10
y = 3
while x > 0
x = x - y
y = y + 1
endwhile
print(x)
Model Answer:
| Step | x | y | x > 0? |
|---|---|---|---|
| Init | 10 | 3 | true |
| 1 | 7 | 4 | true |
| 2 | 3 | 5 | true |
| 3 | -2 | 6 | false |
Output: -2
Question: What is the output of the following code?
word = "COMPUTING"
x = word.length
y = word.substring(0, 4)
z = word.substring(4, x)
print(y.lower + " " + z)
Model Answer:
x = 9 (length of "COMPUTING")y = "COMP" (characters at indices 0, 1, 2, 3)z = "UTING" (characters at indices 4, 5, 6, 7, 8)y.lower = "comp"Question: Write a function called isEven that takes an integer as a parameter and returns true if the number is even, or false if it is odd.
OCR Pseudocode:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.