0% found this document useful (0 votes)
6 views12 pages

Programming

The document consists of past exam questions from IGCSE/O-Level Computer Science focusing on programming concepts such as selection, repetition, data types, pseudocode algorithms, and validation checks. It includes various tasks requiring the identification of programming structures, writing pseudocode, and explaining programming concepts. The questions are structured to assess understanding of fundamental programming principles and the ability to apply them in practical scenarios.

Uploaded by

nabeel ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views12 pages

Programming

The document consists of past exam questions from IGCSE/O-Level Computer Science focusing on programming concepts such as selection, repetition, data types, pseudocode algorithms, and validation checks. It includes various tasks requiring the identification of programming structures, writing pseudocode, and explaining programming concepts. The questions are structured to assess understanding of fundamental programming principles and the ability to apply them in practical scenarios.

Uploaded by

nabeel ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

March 2019 Paper 22, question 4

4 For each of the four groups of statements in the table, place a tick in the correct column to
show whether it is an example of Selection or Repetition.

Statements Selection Repetition

[4]

June 2019 Paper 21, question 2

2 Describe each of the following data types used in programming. In each case, give an
example of a piece of data to illustrate your answer. Each example must be different.
Char
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
String
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Boolean
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[6]

http://SirRazaAcademy.com Compiled by: Syed M.Raza 1


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

June 2019 Paper 21, question 3

3 (a) Give an example of a conditional statement using pseudocode.


...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) Describe the purpose of a conditional statement.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................... [2]

June 2019 Paper 22, question 4


4 For each of the four groups of statements in the table, place a tick in the correct column to
show whether it is an example of Selection or Repetition.

Statements Selection Repetition

[4]
June 2019 Paper 23, question 5
5 Identify and describe three loop structures that are available in pseudocode.

Loop structure 1 ............................................................................................................................


.......................................................................................................................................................
Description ....................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................

http://SirRazaAcademy.com Compiled by: Syed M.Raza 2


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

Loop structure 2 ............................................................................................................................


.......................................................................................................................................................
Description ....................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Loop structure 3 ............................................................................................................................
.......................................................................................................................................................
Description ....................................................................................................................................
.......................................................................................................................................................
..................................................................................................................................................[6]

Nov 2019 Paper 22, question 5

5 A programmer writes a program to weigh baskets of fruit in grams, keeping a total of the
weight and counting the number of baskets. The total weight is stored in a variable Total and
the number of baskets is stored in a variable BasketCount.
Explain, including examples of programming statements, how totalling and counting could be
used in this program.

Totalling ........................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Counting ........................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
...................................................................................................................................................[4]

Nov 2019 Paper 22, question 6

6 Explain why constants, variables and arrays are used in programming.


Constants
.........................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................

http://SirRazaAcademy.com Compiled by: Syed M.Raza 3


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

Variables
..........................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Arrays ...........................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
...................................................................................................................................................[6]

Nov 2019 Paper 23, question 4

4 The following pseudocode algorithm uses nested IF statements.


IF Response = 1
THEN
X X + Y
ELSE
IF Response = 2
THEN
X X – Y
ELSE
IF Response = 3
THEN
XX*Y
ELSE
IF Response = 4
THEN
XX/Y
ELSE
OUTPUT "No response"
ENDIF
ENDIF
ENDIF
ENDIF
(a) Name the type of statement demonstrated by the use of IF … THEN … ELSE … ENDIF
...................................................................................................................................................
............................................................................................................................................. [1]
(b) Re-write the pseudocode algorithm using a CASE statement.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................

http://SirRazaAcademy.com Compiled by: Syed M.Raza 4


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[4]

June 2020 Paper 21, question 4

4 The pseudocode algorithm shown has been written by a teacher to enter marks for the
students in her class and then to apply some simple processing.

Count ←0
REPEAT
INPUT Score[Count]
IF Score[Count] >= 70
THEN
Grade[Count] ← "A"
ELSE
IF Score[Count] >= 60
THEN
Grade[Count] ← "B"
ELSE
IF Score[Count] >= 50
THEN
Grade[Count] ← "C"
ELSE
IF Score[Count] >= 40
THEN
Grade[Count] ← "D"
ELSE
IF Score[Count] >= 30
THEN
Grade[Count] ← "E"
ELSE
Grade[Count] ← "F"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

Count ←
Count + 1
UNTIL Count = 30

http://SirRazaAcademy.com Compiled by: Syed M.Raza 5


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

(a) Describe what happens in this algorithm.


...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[3]

(b) Write the pseudocode to output the contents of the arrays Score[] and Grade[] along with
suitable messages.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) Describe how you could change the algorithm to allow teachers to use it with any size of
class.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.....................................................................................................................................[3]

http://SirRazaAcademy.com Compiled by: Syed M.Raza 6


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

June 2020 Paper 22, question 2

2 (a) Write an algorithm in pseudocode to input 500 positive whole numbers. Each number
input must be less than 1000. Find and output the largest number input, the smallest number
input and the range (difference between the largest number and smallest number).
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[6]
(b) Describe how the algorithm could be changed to make testing less time-consuming.

...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[2]

http://SirRazaAcademy.com Compiled by: Syed M.Raza 7


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

June 2020 Paper 22, question 5


5 A one-dimensional array dataArray[1:20] needs each element set to zero.
(a) Write a pseudocode routine that sets each element to zero. Use the most suitable loop
structure.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(b) Explain why you chose this loop structure.
...................................................................................................................................................
..................................................................................................................................[1]
June 2020 Paper 23, question 2
2 Draw a line to connect each Data Type to the most appropriate Description.

Data Type Description


Real Must be a whole number

String Must be one of two values

Integer May be any number

Boolean May contain any combination of


characters
[3]

June 2020 Paper 23, question 3

3 Identify a suitable validation check that could be used for each piece of normal test data and
describe how it would be used. Each validation check must be different.
Test data for entering an email address: [email protected]

Validation check name...................................................................................................................


Description of use .........................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Test data for entering a year: 2021
Validation check name .................................................................................................................
Description of use ........................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................

http://SirRazaAcademy.com Compiled by: Syed M.Raza 8


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

Test data for entering a name: Ericson-Bower


Validation check name ..................................................................................................................
Description of use .......................................................................................................................
......................................................................................................................................................
...................................................................................................................................................[6]

June 2020 Paper 23, question 4


4 The pseudocode algorithm should allow a user to input the number of scores to be entered
and
then enter the scores. The scores are totalled, the total is output and the option to enter
another
set of scores is offered.
1 Count ←0
2 REPEAT
3 FullScore ← 20
4 INPUT Number
5 FOR StoreLoop ← 1 TO Number
6 INPUT Score
7 FullScore ← FullScore
8 UNTIL StoreLoop = Number
9 OUTPUT "The full score is ", FullScore
10 OUTPUT "Another set of scores (Y or N)?"
11 OUTPUT Another
12 IF Another = "N"
13 THEN
14 Count ←1
15 ENDIF
16 UNTIL Count = 1

(a) Identify the four errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 .......................................................................................................................................
Correction .................................................................................................................................
...............................................................................................................................................[4]
http://SirRazaAcademy.com Compiled by: Syed M.Raza 9
IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

2023 Specimen Paper 2, question 1

1 Four pseudocode descriptions and five pseudocode statements are shown.


(a) Draw a line to link each pseudocode description to the most appropriate pseudocode
statement.
Some pseudocode statements will not be used.

Pseudocode description Pseudocode statement

a loop that will always iterate at FOR…TO…NEXT


least once
a conditional statement to deal IF…THEN…ELSE…ENDIF
with many possible outcomes
a loop that will always iterate a WHILE…DO…ENDWHILE
set number of times
a conditional statement with CASE…OF…OTHERWISE…ENDCASE
different outcomes for true and
false REPEAT…UNTIL

[4]

(b) Using a single loop, write an algorithm in pseudocode to output 50 names that have been
stored in the array, Name[]
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
................................................................................................................................................[3]

2023 Specimen Paper 2, question 3


3 Tick () one box to show the named section of a program that performs a specific task.

A file
B function
C parameter
D process
[1]

http://SirRazaAcademy.com Compiled by: Syed M.Raza 10


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

2023 Specimen Paper 2, question 8


8 A programmer has written an algorithm to check that prices are less than $10.00
These values are used as test data:
10.00 9.99 ten
State why each value was chosen as test data.
10.00 .............................................................................................................................................
.......................................................................................................................................................
9.99 ..............................................................................................................................................
.......................................................................................................................................................
ten .................................................................................................................................................
...................................................................................................................................................[3]
2023 Specimen Paper 2, question 9
9 Explain why a program might need to store data in a file.
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
...................................................................................................................................................[3]

2023 Specimen Paper 2, question 10

10 A function is declared using pseudocode.


FUNCTION ConvertToCm(Inches: REAL) RETURNS REAL
RETURN Inches * 2.4
ENDFUNCTION
Tick () one box which accurately describes the use of the variable Inches

A answer
B call
C parameter
D response
[1]

2023 Specimen Paper 2, question 12


12 The variables X, Y and Z are used to store data in a program:
• X stores a string
• Y stores a position in the string (e.g. 2)
• Z stores the number of characters in the string.
(a) Write pseudocode statements to declare the variables X, Y and Z.
....................................................................................................................................................
....................................................................................................................................................

http://SirRazaAcademy.com Compiled by: Syed M.Raza 11


IGCSE / O-LEVEL Computer Science TOPICAL PAST PAPERS – PROGRAMMING

....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [3]
(b) The function Length(X) finds the length of a string X.
The function SubString(X,Y,Z) finds a substring of X starting at position Y and Z
characters long. The first character in X is in position 1.
Write pseudocode statements to:
• store the string "Programming is fun" in X
• find the length of the string and output it
• extract the word fun from the string and output it.
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
............................................................................................................................................... [6]

http://SirRazaAcademy.com Compiled by: Syed M.Raza 12

You might also like