About Programming and object-oriented programming in A Level Computer Science
Programming and object-oriented programming is one of the 10 main topics in our A Level Computer Science (Cambridge (CAIE) 9618) question bank, and about 35% of its real questions come from it. Tayyari Karo has 397 real questions on this topic from 2021 to 2026, from Paper 1, Paper 2, Paper 3, Paper 4. By difficulty: 170 easy, 135 medium, 92 hard.
Work through the questions below, then open the explanation for each one. Redo the ones you missed a few days later.
Try 8 real questions
These are real past-paper questions. Think of your answer first, then open the explanation.
May/June 2026 · Paper 2 · Programming and object-oriented programming
Study this pseudocode: FOR i <- 3 TO 12 STEP 3 / OUTPUT i, i * i / NEXT i. (a) Identify the type of construct used in this pseudocode. [1]
Show model answer
Count-controlled loop // count-controlled iteration
A FOR loop repeats a fixed number of times.
May/June 2025 · Paper 4 · Programming and object-oriented programming
(e)(i) Write program code for the main program which calls ReadData() and then SplitData().
Show model answer
DataFromFile = ReadData();
SplitData(DataFromFile);
3 marks: 1 for calling ReadData, 1 for storing/using return value, 1 for calling SplitData with returned array.
May/June 2024 · Paper 3 · Programming and object-oriented programming
(a) Explain what is meant by non-composite and composite data types.
Show model answer
Non-composite:
• Non-composite data types can be user-defined or primitive
• Do not refer to other data types in their definition / contain one data type
• Can be primitive/enumerated/pointer
Composite:
• Composite data types can be user-defined or primitive
• Refer to other data types in their definition / contain more than one data type
• Can be record/set/class
3 marks: up to 2 for non-composite, up to 2 for composite (max 3).
October/November 2024 · Paper 2 · Programming and object-oriented programming
(d) The final CASE condition (> 200) in the pseudocode example could be replaced with a keyword. Give the keyword.
Show model answer
OTHERWISE
1 mark.
May/June 2023 · Paper 3 · Programming and object-oriented programming
(a) Describe what is meant by recursion.
Show model answer
• A process using a function or procedure defined in terms of itself / calls itself
• A recursive process must have a base case (which is a way to return without making a recursive call) / terminating solution / concept of unwinding
• There must (also) be a general case where the recursive call takes place
2 marks: 1 each to max 2.
October/November 2023 · Paper 2 · Programming and object-oriented programming
(c)(ii) Explain how the message format could be changed to allow a blank line to be sent.
Show model answer
• Append a (special) character to the start of the message text and interpret the new field data as a blank line
• Or: Change the message protocol and use an additional field to act as an indicator and interpret the new field data
2 marks: 1 for each point.
October/November 2022 · Paper 2 · Programming and object-oriented programming
(d) Identify two types of errors that CheckLine() might detect in a student's program.
Show model answer
• Incorrect block structure. Missing keyword denoting part of block (for example ENDPROCEDURE, ENDFUNCTION, ENDTYPE)
• Data type errors, for example assigning an integer value to a string
• Identifier used before it is declared
• Incorrect parameter use
2 marks: 1 for each to max 2.
May/June 2021 · Paper 3 · Programming and object-oriented programming
(b)(i) Define, using pseudocode, the enumerated data type SchoolDay to hold data about the days students are usually in school.
Show model answer
TYPE SchoolDay = (Monday, Tuesday, Wednesday, Thursday, Friday)
1 mark.