Programming – O Level Computer Science (2210)

174 questions · page 12 of 12 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
166
2210/21/M/J/16 · Question 1May/June 2016Paper 2120 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
(i)
For each of the variables that you have used to record dimensions of the parcels in Task 1,
state the name, type and its use.
Variable 1 name …
Type …
Use …
Variable 2 name …
Type …
Use …
Variable 3 name …
Type …
Use … [3]
(ii)
State two constants that you could have used for Task 1. Give the value that would be
assigned to each one.
Constant 1 name …
Value 1 …
Constant 2 name …
Value 2 … [2]
(b) Write an algorithm to complete Task 1, using either pseudocode, programming statements
or a flowchart.
…
…
…
…
…
…
…
…
…
…
…
…
…

167
2210/21/M/J/16 · Question 2May/June 2016Paper 216 marks
Loading question…
Question text

2
Read this section of program code that inputs 10 positive numbers and then outputs the smallest
number input.
1
Small = 1000
2
Counter = 0
3
REPEAT
4
INPUT Num
5
IF Num < Small THEN Small = Num
6
Counter = Counter + 1
7
UNTIL Counter = 10
8
PRINT Small
(i)
Identify three changes you would need to make to find the largest number input instead
of the smallest number.
1 …
…
2 …
…
3 …
… [3]
(ii)
Rewrite the program code with your changes.
…
…
…
…
…
…
…
… [3]

168
2210/21/M/J/16 · Question 3May/June 2016Paper 217 marks
Loading question…
Question text

3
A program will be written to store information about members of a swimming club.
The following membership details will be recorded:
•
Name
•
Gender
•
Status:
•
Senior
•
Junior
•
Fee
•
Team member (Yes or No)
(i)
Choose a suitable data type for each of the membership details to be recorded.
Membership details
Data type
Name
Gender
Status
Fee
Team member
[5]
(ii)
The swimming club has 50 members.
State the data structure that would be most suitable to use and give a reason for your
choice.
Data structure …
Reason …
… [2]

Advertisement
169
2210/21/M/J/16 · Question 5May/June 2016Paper 214 marks
Loading question…
Question text

REPEAT ... UNTIL is one type of loop structure.
5
Identify and describe two other types of loop structure that you could use when writing
pseudocode.
Loop structure 1 …
Description …
…
Loop structure 2 …
Description …
… [4]

170
2210/22/M/J/16 · Question 1May/June 2016Paper 2220 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
(i)
For three of the variables that you have used in Task 2, state the name, type and its use.
Variable 1 name …
Type …
Use …
Variable 2 name …
Type …
Use …
Variable 3 name …
Type …
Use … [3]
(ii)
State three constants that you could have used for Task 1. Give the value that would be
assigned to each one.
Constant 1 name …
Value 1 …
Constant 2 name …
Value 2 …
Constant 3 name …
Value 3 … [3]
(b) Write an algorithm to complete Task 2, using either pseudocode, programming statements
or a flowchart. You can assume that the weight and contents have already been checked and
accepted in Task 1. You do not need to output the number of sacks rejected.
…
…
…
…
…
…
…
…
…
…

171
2210/22/M/J/16 · Question 2May/June 2016Paper 226 marks
Loading question…
Question text

2
Read this section of program code that inputs 10 positive numbers and then outputs the total.
1
Total = 0
2
Counter = 0
3
REPEAT
4
INPUT Num
5
Total = Total + Num
6
PRINT Total
7
Counter = Counter + 1
8
UNTIL Counter = 10
This code works, but it is inefficient.
(i)
Suggest three improvements that could be made.
1 …
…
2 …
…
3 …
… [3]
(ii) Rewrite the program code with your improvements.
…
…
…
…
…
…
…
…
…
… [3]

172
2210/22/M/J/16 · Question 4May/June 2016Paper 223 marks
Loading question…
Question text

4
Four statement types and four examples are shown below.
Draw a line to connect each statement type to the correct example.
Statement type
Example
1 TO 10
FOR X
Assignment
READ X
Iteration
PRINT X
Input
Y + Z
X
Output
[3]

173
2210/22/M/J/16 · Question 5May/June 2016Paper 222 marks
Loading question…
Question text

5
A programmer writes a program to store a patient’s temperature every hour for a day.
State the data structure that would be most suitable to use and give the reason for your choice.
Data structure …
Reason …
… [2]

Advertisement
174
2210/22/M/J/16 · Question 6May/June 2016Paper 222 marks
Loading question…
Question text

6
Identify two different selection statements that you can use when writing pseudocode.
1 …
…
2 …
… [2]
Question 7 begins on page 10.

Advertisement