Programming – IGCSE Computer Science (9–1) (0984)
Quick quiz: 10 random questions from this topic. Answer them all, then open the Summary.
Question text
1
All variables, constants and other identifiers must have meaningful names.
(a) (i)
Identify one variable you could have used for Task 2 and state its use.
Variable …
Use …
…
…
[2]
(ii)
Describe the arrays you could have used in Task 1. Include the name, data type, use
and sample data for each array.
…
…
…
…
…
…
…
…
…
…
…
… [5]
(b) Describe how you could validate the data entry for the input of the codes for the different
stages of the journey in Task 2.
…
…
…
…
…
… [3]
(c) Write an algorithm to show how your program carries out Task 3, using either pseudocode,
programming statements or a flowchart. Assume Tasks 1 and 2 have already been completed.
…
…
Question text
4
The pseudocode algorithm should work as a calculator and output the result.
1
1 Continue
2 WHILE Continue = 0
3
OUTPUT "Enter 1 for +, 2 for -, 3 for * or 4 for /"
4
INPUT Operator
5
OUTPUT "Enter the first value"
6
INPUT Value1
7
OUTPUT "Enter the second value"
8
OUTPUT Value2
9
IF Operator
Value1 + Value2
10
1: Answer
Value1 - Value2
11
2: Answer
Value1 * Value2
12
3: Answer
Value1 / Value2
13
4: Answer
14
ENDCASE
15
OUTPUT "The answer is ", Value1
16
OUTPUT "Do you wish to enter more values (Yes or No)?"
17
INPUT MoreValues
18
IF MoreValues = "No"
19
THEN
1
20
Continue
21
ENDIF
22 UNTIL Continue = 0
(a) Find the five errors in the pseudocode and suggest a correction for each error.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
Error 5 …
Correction …
…
[5]
(b) The algorithm needs changing to allow only the numbers 1, 2, 3, or 4 to be entered for the
input variable Operator.
Write the pseudocode to perform this task and state where in the algorithm it would be
located.
Pseudocode …
…
…
…
…
…
…
Question text
11
The function Power(FirstNumber, SecondNumber) returns the value of FirstNumber
raised to the power of SecondNumber. FirstNumber and SecondNumber are integers.
Write pseudocode statements to:
•
define the function
•
call the function with the variables A and B and store the return value in the variable Value
function definition
…
…
…
…
…
…
function call
…
…
[5]
© Cambridge University Press & Assessment 2026
Question text
2
Tick (3) one box to identify a programming data type used to store a single letter, symbol or
number input from the keyboard.
A
Boolean
B
char
C
integer
D
real
[1]
Question text
2
Identify four operators that are not arithmetic operators from the list.
/
>
<=
+
*
^
AND
DIV
MOD
NOT
1 …
2 …
3 …
4 …
[4]
Question text
3
(a) Identify the type of validation check used in each description.
(i)
A check to make sure that data has been input and not left blank.
… [1]
(ii)
A value placed at the end of a sequence of numbers in the code. The value is calculated
from all the other values before it.
… [1]
(b) Explain the purpose of a format check and give an example of where it could be used.
purpose …
…
…
…
…
example …
…
[3]
© Cambridge University Press & Assessment 2026
,
,
(c) Write the pseudocode for an algorithm to perform a validation check on each number as it is
input, using the following criteria:
•
Input one number at a time.
•
If the number is a whole number, store it in the current element of array Accepted[]
•
If the number is not a whole number, ask for it to be input again until it is a
whole number.
•
When 15 whole numbers have been stored, output a message that states the check has
been completed.
Use appropriate input prompts and output messages to make the requirements clear to
the user.
You do not need to declare any arrays or variables for this algorithm.
…
…
…
…
…
…
…
…
…
…
…
…
Question text
1
(a) All variables, constants and other identifiers must have meaningful names.
(i)
Describe the data structures that you have used to store the data for the concrete slabs
in Task 1, include the name, data type and use for each data structure.
…
…
…
…
…
…
…
…
…
…
… [5]
(ii)
State one variable that you have used in Task 3.
Give the data type for the variable. State what it is used for.
Variable name …
Data type …
Use …
…
[3]
(b) Explain how you calculated the volume of a concrete slab in Task 1.
…
…
…
…
…
… [3]
(c) Write an algorithm for Task 2, using either pseudocode, programming statements or a
flowchart. Assume that Task 1 has been completed.
…
…
…
Question text
10 A program is required to record and analyse the daily rainfall in millimetres for one year. Assume
a year has 365 days.
The one-dimensional (1D) array Rainfall[] is used to store the daily rainfall measurements.
Write a program for the following requirements:
•
Initialise the array Rainfall[] to zero.
•
Input the rainfall measurement in millimetres for each day and store it in the array.
•
Calculate the following statistics after all the inputs have been made for the year:
◦
the total rainfall for the year in centimetres (1 centimetre = 10 millimetres), rounded to
two decimal places
◦
the mean average daily rainfall in millimetres, rounded to four decimal places
◦
the total number of days with no rainfall
◦
the longest number of consecutive days in which there was no rainfall.
•
Output all the calculated statistics with clear and appropriate messaging.
•
If the longest number of consecutive days in which there was no rainfall is 15 or more,
output a message to indicate there was a drought (a long period when there is little or
no rainfall).
You must use pseudocode or program code and add comments to explain how your code works.
All arrays, variables or constants used must be declared for this algorithm.
All inputs and outputs must contain suitable messages.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
© Cambridge University Press & Assessment 2026
,
,
…
…
…
Question text
12 A weather monitoring station records the number of minutes of sunshine for each day of a month.
The one‑dimensional (1D) array Sunshine[] is used to store the number of minutes of sunshine
for each day. The index of the array represents the day.
The one‑dimensional (1D) array MonthDays[] contains the number of days in each month. The
index of the array represents the month. In this array, 28 is stored in index 2 for the month of
February. However, there are 29 days in February in a leap year.
In this program, a leap year is a year that divides by 4 with no remainder. For example, 2026 is
not a leap year but 2028 will be a leap year.
Write a program that meets the following requirements:
•
allows the user to input a year, calculates whether it is a leap year and updates the number
of days in February as appropriate
•
allows a user to input the name of one of the first three months of the year: January,
February or March
•
allows a user to input the number of minutes of sunshine for each day of the month and
validates the input
•
calculates the total amount of sunshine for the month in hours and minutes
•
finds the highest amount of daily sunshine for the month
•
outputs the:
◦
year
◦
month
◦
total amount of sunshine for the month in hours and minutes
◦
the highest amount of daily sunshine for the month.
You must use pseudocode or program code and add comments to explain how your code works.
Do not declare any arrays or variables; assume that this has already been done.
All inputs and outputs must contain suitable messages.
…
…
…
…
…
…
…
…
…
…
…
© Cambridge University Press & Assessment 2026
,
,
…
…
…
…
…
Question text
7
An algorithm has been written in pseudocode for a user to repeatedly input positive whole
numbers and store them in an array called Values[] until –1 is input or until the array is full.
The algorithm outputs the average of the numbers to 2 decimal places.
01
DECLARE Counter : INTEGER
02
DECLARE Total : INTEGER
03
DECLARE Average : INTEGER
04
DECLARE Values : ARRAY[1:100] OF INTEGER
1
05
Counter
0
06
Total
07
OUTPUT "Please enter a positive whole number or ‑1 "
08
INPUT Number
09
WHILE Number = ‑1 AND Counter <= 100 DO
Number
10
Values[Counter]
Total + 1
11
Total
Counter + 1
12
Counter
13
INPUT Number
14
ENDWHILE
Counter ‑ 1
15
Counter
Counter / Total
16
Average
17
OUTPUT "The average is ", ROUND(Average, 2)
Identify the line numbers of four errors in the pseudocode and suggest a correction for
each error.
error 1 line number …
correction …
…
error 2 line number …
correction …
…
error 3 line number …
correction …
…
error 4 line number …
correction …
…
[4]
© Cambridge University Press & Assessment 2026