Programming — AS & A Level Computer Science (9618) questions by topic
Programming is the largest topic here by mark volume, with 79 real questions from 2023 to 2025 papers ranging from completing an OOP-terms table, through writing a masking function for card numbers, to explaining why syntax-diagram inputs are invalid, worth anything from 4 to 34 marks.
Write, state, complete, describe and identify dominate the command words, and write means producing working, runnable code that satisfies the stated specification, not pseudocode alone. Examiners report precise, recurring bugs, like a recursive function missing its base case, so writing and submitting real code for instant marking is the fastest way to catch that before it repeats across a whole exercise.
What examiners look for
- A recurring criticism is functions that fail to produce a recursive solution, containing no recursive call and simply repeating the earlier part's answer.
- Examiners note constructors written without the required parameters, or that assign values directly to attributes instead of to the parameters first.
- Reports flag Python methods that omit the required self parameter, and get methods that read in or overwrite the attribute rather than simply returning it.
- A common error was calling a function with a variable name instead of the required string, omitting the necessary speech marks.
- Strong answers identified the correct string-manipulation functions for their chosen language, followed the given algorithm's structure exactly, produced a recursive call on a progressively shorter string, and declared classes and constructors correctly.
May–June 2025, Paper 13
A programmer is writing a program in a high-level language. Complete the description of compilers and interpreters by writing the missing words. A compiler checks all the code…
Answer this question and get it marked →May–June 2025, Paper 21
A program is being developed to implement a customer loyalty scheme for a coffee shop. The programmer has decided that the following data items need to be stored for each…
Answer this question and get it marked →May–June 2025, Paper 22
An algorithm is designed to generate and output two unique random integers. Each integer value is between -10 and 10 inclusive. If both integers output are negative, a third…
Answer this question and get it marked →Two arrays Data and Pointer are accessed by the procedure Place(). Data and Pointer are both global arrays of type INTEGER. The contents of these two arrays are shown (index :…
Answer this question and get it marked →May–June 2025, Paper 23
A programmer has been asked to create a module RollDice() to simulate multiple rolls of a dice. This module will be used as part of a program for a game. The module will: step 1 –…
Answer this question and get it marked →A module Parity() takes a string as a parameter. The parameter has the identifier BitString and it represents a binary value. The module will concatenate a single character to the…
Answer this question and get it marked →A program is being developed to implement a customer loyalty scheme for a coffee shop. The programmer has decided that the following data items need to be stored for each…
Answer this question and get it marked →May–June 2025, Paper 31
A programmer is writing a program to manage bookings for a small taxi company. The programmer requires some user-defined data types. Write a pseudocode statement to declare the…
Answer this question and get it marked →Several syntax diagrams are shown. <uppercase may be one of: A, C, E, G, J <lowercase may be one of: b, d, f, h, k <symbol may be one of: $, @, , &, % <digit may be one of: 0, 1,…
Answer this question and get it marked →May–June 2025, Paper 32
Several syntax diagrams are shown. The syntax diagrams define: - letter: one of A, B, C, D, E, F, G, H, J, K - digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 - operator: one of + , −…
Answer this question and get it marked →A medical clinic uses objects of the class Patient to assign a priority and a doctor to a patient. Some of the attributes required in the class are listed in the table. Attribute…
Answer this question and get it marked →May–June 2025, Paper 33
Complete the table by filling in the missing object-oriented programming (OOP) terms and descriptions. OOP term Description ---------- ------------- ............ A method that…
Answer this question and get it marked →Several syntax diagrams are shown. <upper selects one of: J, K, L, V, X, Z. <lower selects one of: a, e, i, p, u, y. <digit selects one of: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The…
Answer this question and get it marked →The recursive procedure Delete() is defined as follows: PROCEDURE Delete(Index, Target) IF Numbers[Index] 0 THEN IF Numbers[Index] = Target THEN Numbers[Index] <- Numbers[Index +…
Answer this question and get it marked →May–June 2024, Paper 12
The programmer decides to use the compiler when testing the final program. Describe the benefits of using the compiler during testing.
Answer this question and get it marked →May–June 2024, Paper 21
Complete the pseudocode for module DeleteComment(). FUNCTION DeleteComment(Line : STRING) RETURNS STRING ... ENDFUNCTION
Answer this question and get it marked →May–June 2024, Paper 23
Write pseudocode for the procedure TwoParts().
Answer this question and get it marked →Write pseudocode for procedure Progress().
Answer this question and get it marked →The teacher has defined the first program module as follows: Header() will: - be called with a parameter of type string representing a line of pseudocode - if the line is a valid…
Answer this question and get it marked →May–June 2024, Paper 31
Write this Reverse Polish Notation (RPN) in infix form: 5 2 + 9 3 – / 3
Answer this question and get it marked →May–June 2024, Paper 32
Write this infix expression in Reverse Polish Notation (RPN): (7 – 2 + 8) / (9 – 5)
Answer this question and get it marked →May–June 2024, Paper 33
Write this Reverse Polish Notation (RPN) in infix form: 5 2 + 9 3 – / 3
Answer this question and get it marked →May–June 2024, Paper 42
Write program code to declare the class Node and its constructor. Do not declare the other methods. Use the appropriate constructor for your programming language. If you are…
Answer this question and get it marked →May–June 2024, Paper 43
Write program code to declare the class Tree and its constructor. Do not declare the other methods. Use the appropriate constructor for your programming language. All attributes…
Answer this question and get it marked →October–November 2024, Paper 21
A program will calculate the tax payable based on the cost of an item. Calculations will occur at many places in the program and these involve the use of one of three tax rates.…
Answer this question and get it marked →October–November 2024, Paper 22
The function Conceal() will: - take a numeric string as a parameter representing the card number - return a string in which the asterisk character replaces all except the last…
Answer this question and get it marked →A global integer variable Tick is always incremented every millisecond (1000 times per second) regardless of the other programs running. The value of Tick can be read by any…
Answer this question and get it marked →Complete the pseudocode for the procedure Special(). Assume that both arrays are global. PROCEDURE Special() ... ENDPROCEDURE
Answer this question and get it marked →Write pseudocode for module Assign().
Answer this question and get it marked →October–November 2024, Paper 23
The following table contains pseudocode examples. Each example may contain statements that relate to one or more of the following: - selection - iteration (repetition) -…
Answer this question and get it marked →Write pseudocode for the algorithm. Assume the value zero is neither positive nor negative. You must declare all variables used in the algorithm.
Answer this question and get it marked →The pseudocode algorithm to determine whether a paper should be checked is as shown. The mark for the paper is stored in variable Mark. Global variables Mark, Index, Upper and…
Answer this question and get it marked →In some countries, on the third Sunday in March, daylight saving time begins when clocks move forward by one hour. A module AdjustClock() will take an integer parameter…
Answer this question and get it marked →Complete the pseudocode for module Count(). PROCEDURE Count(ThisPlayer : INTEGER, ThisRole : STRING) ............................................................... ENDPROCEDURE
Answer this question and get it marked →October–November 2024, Paper 31
State one reason why the attributes would be declared as PRIVATE.
Answer this question and get it marked →Complete the Backus-Naur Form (BNF) for the given syntax diagrams. <operator ::= ... <label ::= ... <equation ::= ...
Answer this question and get it marked →October–November 2024, Paper 32
State why each number is invalid for the given syntax diagrams. 21 Reason ............ 123 Reason ............
Answer this question and get it marked →Objects and classes form the basic structure of Object-Oriented Programming (OOP). Outline the structure of a class.
Answer this question and get it marked →October–November 2024, Paper 33
State one reason why the attributes would be declared as PRIVATE.
Answer this question and get it marked →Complete the Backus-Naur Form (BNF) for the given syntax diagrams. <operator ::= .............................................. <label ::=…
Answer this question and get it marked →October–November 2024, Paper 41
A computer program is designed to simulate horses doing show jumping. In show jumping, horses jump over obstacles called fences. A horse successfully jumps a fence if it does not…
Answer this question and get it marked →October–November 2024, Paper 42
(a) The class EventItem stores data about the events. EventItem --- --- EventName : STRING stores the name of the event Type : STRING stores the type of event, either: jump, swim,…
Answer this question and get it marked →May–June 2023, Paper 12
The program is converted into machine code by a two-pass assembler. Draw one or more lines to identify the pass or passes in which each action takes place. Actions: - generates…
Answer this question and get it marked →May–June 2023, Paper 21
Function Replace() will: 1. take three parameters: - a string (the original string) - a char (the original character) - a char (the new character) 2. form a new string from the…
Answer this question and get it marked →A video-conferencing program supports up to six users. Speech from each user is sampled and digitised (converted from analogue to digital). Digitised values are stored in array…
Answer this question and get it marked →Write pseudocode for module IsNewSupp(). Module SuppExists() has already been written and should be used as part of your solution. Module SuppExists() will generate a run-time…
Answer this question and get it marked →May–June 2023, Paper 22
A program stores a user's date of birth using a variable MyDOB of type DATE. Write a pseudocode statement, using a function from the insert, to assign the value corresponding to…
Answer this question and get it marked →A function GetNum() will: 1. take two parameters: a string and a character 2. count the number of times that the character occurs in the string 3. return the count. Any comparison…
Answer this question and get it marked →A procedure Square() will take an integer value in the range 1 to 9 as a parameter and output a number square. The boundary of a number square is made up of the character…
Answer this question and get it marked →A computer shop assembles computers using items bought from several suppliers. A text file Stock.txt contains information about each item. Information for each item is stored as a…
Answer this question and get it marked →May–June 2023, Paper 23
A program stores a date of birth for a student using a variable, MyDOB, of type DATE. MyDOB has been assigned a valid value corresponding to Kevin's date of birth. Complete the…
Answer this question and get it marked →A function MakeString() will: 1. take two parameters: - a count as an integer - a character 2. generate a string of length equal to the count, made up of the character 3. return…
Answer this question and get it marked →A procedure Select() will: 1. take two integer values as parameters representing start and end values where both values are greater than 9 and the end value is greater than the…
Answer this question and get it marked →May–June 2023, Paper 31
State whether each of the following passwords is valid or invalid and give a reason for your choice. DPAD99$ DAD95 ADY123?
Answer this question and get it marked →May–June 2023, Paper 32
The syntax diagrams for 'digit', 'letter' and 'variable' are shown on page 4. State whether each variable is valid or invalid and give a reason for your choice in each case. 9SW…
Answer this question and get it marked →Draw one line from each Object-Oriented Programming (OOP) term to its most appropriate description. OOP terms: - Encapsulation - Getters - Polymorphism - Setters Descriptions: -…
Answer this question and get it marked →May–June 2023, Paper 33
State whether each of the following passwords is valid or invalid and give a reason for your choice. DPAD99$ Reason ............................................ DAD95 Reason…
Answer this question and get it marked →May–June 2023, Paper 41
A computer game is being designed that will include different vehicles. A prototype for the game is being developed using object-oriented programming. The class Vehicle stores…
Answer this question and get it marked →May–June 2023, Paper 42
A company needs a computer program to store data about its employees. Part of the program is being written using object-oriented programming. The class Employee stores data about…
Answer this question and get it marked →May–June 2023, Paper 43
A computer game is being designed that will include different vehicles. A prototype for the game is being developed using object-oriented programming. The class Vehicle stores…
Answer this question and get it marked →October–November 2023, Paper 11
Identify the purpose of the first pass of a two-pass assembler.
Answer this question and get it marked →October–November 2023, Paper 21
A global array is declared in pseudocode as follows: DECLARE Data : ARRAY[1:150] OF STRING A function TooMany() will: 1. take two parameters: - a string (the search string) - an…
Answer this question and get it marked →The pseudocode contains three errors due to the incorrect use of operators. Identify each error and state the correction required.
Answer this question and get it marked →Write pseudocode for module SendFile(). Assume: - module Transmit() has already been written and is used to transmit a message - the value of MyID may be used as SourceID - the…
Answer this question and get it marked →October–November 2023, Paper 22
Write pseudocode for the procedure Count().
Answer this question and get it marked →Write pseudocode for CreateFiles(). Assume both parameters are valid and that the integer value is between 1 and 999, inclusive.
Answer this question and get it marked →The programmer has defined the first program module as follows: Module Description --- --- GetPort() takes a DestinationID as a parameter of type string; searches for the range…
Answer this question and get it marked →October–November 2023, Paper 23
Write pseudocode for procedure RandList().
Answer this question and get it marked →A function TestNum() will take a six-digit string as a parameter. The function will test whether the string meets certain conditions and will return an integer value as follows:…
Answer this question and get it marked →Write pseudocode for module ReceiveFile(). Module GetData() has already been written and must be used.
Answer this question and get it marked →October–November 2023, Paper 32
Describe, with an example, what is meant by an exception.
Answer this question and get it marked →October–November 2023, Paper 41
Write program code for the function IterativeVowels(). Save your program as Question1N23. Copy and paste the program code into part 1(a)(i) in the evidence document.
Answer this question and get it marked →October–November 2023, Paper 42
An integer is said to be divisible by another integer if the result of the division is also an integer. For example: 10 is divisible by 1, 2, 5 and 10: • 10 ÷ 1 = 10 • 10 ÷ 2 = 5…
Answer this question and get it marked →A computer game is written using object-oriented programming. The game has multiple characters. The class Character stores data about the game characters. Each character has a…
Answer this question and get it marked →October–November 2023, Paper 43
Write program code for the function IterativeVowels(). Save your program as Question1N23. Copy and paste the program code into part 1(a)(i) in the evidence document.
Answer this question and get it marked →Write program code to declare the class Character and its constructor. Do not declare the other methods. Use your programming language's appropriate constructor. If you are…
Answer this question and get it marked →Other AS & A Level Computer Science topics
- Data types and structures (74)
- Algorithm design and problem-solving (36)
- Information representation (31)
- Communication and internet technologies (29)
- Boolean algebra and logic circuits (29)
- Processor fundamentals (27)
- Software development (27)
- Hardware (18)
- System software (17)
- Security, privacy and integrity of data (13)
- Databases (13)
- Artificial intelligence (13)