Programming – IGCSE Computer Science (9–1) (0984)

25 questions · page 2 of 2 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
16
0984/22/O/N/21 · Question 1Oct/Nov 2021Paper 2220 marks
Loading question…
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.
…
…

17
0984/22/O/N/21 · Question 4Oct/Nov 2021Paper 2210 marks
Loading question…
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 …
…
…
…
…
…
…

18
0984/21/M/J/20 · Question 1May/June 2020Paper 2120 marks
Loading question…
Question text

1
All variables, constants and other identifiers must have meaningful names.
(a) (i)
Identify two arrays you could have used for Task 1 and, in each case, state its purpose.
Array 1 …
Purpose …
…
…
Array 2 …
Purpose …
…
…
[4]
(ii)
Identify two variables you could have used for Task 1 and, in each case, state its
purpose.
Variable 1 …
Purpose …
…
…
Variable 2 …
Purpose …
…
…
[4]
(b) Explain why the item code data could not be stored as a real data type and identify the most
suitable data type for the item code data.
…
…
…
…
…
… [2]
(c) Write an algorithm to show how you input your choice of mobile device and SIM card (part of
Task 1), using either pseudocode, programming statements or a flowchart. It is not necessary
to show initialisation or setting up of arrays containing product details.
…
…

Advertisement
19
0984/21/M/J/20 · Question 4May/June 2020Paper 218 marks
Loading question…
Question text

4
The pseudocode algorithm shown should allow numbers to be entered and should allow
50 numbers to be stored in an array.
←
0
Count
REPEAT
INPUT Values[Count]
←
Count + 1
Count
UNTIL Count = 0
(a) Explain why the algorithm will never end.
…
…
…
…
… [2]
(b) Re-write the original pseudocode so that it terminates correctly and also prevents numbers
below 100 from being stored in the array Values[ ]
…
…
…
…
…
…
…
…
…
… [4]
(c) Describe how you could change your pseudocode in part (b) so that it prevents numbers
below 100 and above 200 from being stored in the array Values[ ]
…
…
…
… [2]

20
0984/21/M/J/20 · Question 5May/June 2020Paper 216 marks
Loading question…
Question text

5
The flowchart represents an algorithm.
The predefined function DIV gives the value of the result of integer division,
←
9 DIV 4 gives y a value of 2
for example, y
An input value of –1 ends the algorithm.
START
INPUT
Value
IS
Yes
Value =
-1 ?
No
Calc1
Value DIV 2
Calc2
Value DIV 3
IS
No
Calc1 =
Value / 2 ?
Yes
IS
No
Calc2 =
Value / 3 ?
Yes
OUTPUT
Value
END
(a) Complete the trace table for the input data:
50, 33, 18, 15, 30, –1, 45, 12, 90, 6
Value
Calc1
Calc2
OUTPUT
[4]
(b) Describe the purpose of the algorithm.
…
…
… [2]

21
0984/22/O/N/19 · Question 1Oct/Nov 2019Paper 2220 marks
Loading question…
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.
…
…
…

22
0984/22/O/N/19 · Question 2Oct/Nov 2019Paper 224 marks
Loading question…
Question text

2
An algorithm has been written in pseudocode to select a random number using the function
RandInt(n), which returns a whole number between 1 and the argument n. The algorithm then
allows the user to guess the number.
RandInt(100)
Number
1
TotalTry
REPEAT
PRINT "Enter your guess now, it must be a whole number"
INPUT Guess
IF TotalTry > Number
THEN
PRINT "Too large try again"
ENDIF
IF Guess > Number
THEN
PRINT "Too small try again"
ENDIF
Guess + 1
TotalTry
UNTIL Guess <> Number
TotalTry - 1
TotalTry
PRINT "Number of guesses ", TotalTry
Find the four errors in the pseudocode and suggest a correction to remove each error.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]

23
0984/22/O/N/19 · Question 3Oct/Nov 2019Paper 227 marks
Loading question…
Question text

3
(a) The flowchart checks the lengths of a batch of 10 ropes. For the batch to be accepted 90% of
the lengths need to be between 24.9 and 25.1 metres.
START
Reject
0
Count
0
Yes
Is Count =
10 ?
No
No
Is Reject
Count
Count + 1
<= 1 ?
INPUT Length
Yes
OUTPUT "Batch
rejected"
Is Length <
Yes
25.1 AND
Length > 24.9 ?
No
Reject
Reject + 1
OUTPUT "Batch
accepted"
END
Complete the trace table for the input data:
24.88, 25.01, 24.98, 25.00, 25.05, 24.99, 24.97, 25.04, 25.19, 25.07
Reject
Count
Length
OUTPUT
[4]
(b) (i)
It has been decided to only reject batches of rope that contain ropes that are too short.
State the change required to the algorithm.
…
… [1]
(ii)
Explain how the algorithm to reject batches could be improved to make it more effective.
…
…
…
… [2]

Advertisement
24
0984/22/O/N/19 · Question 5Oct/Nov 2019Paper 224 marks
Loading question…
Question text

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]

25
0984/22/O/N/19 · Question 6Oct/Nov 2019Paper 226 marks
Loading question…
Question text

6
Explain why constants, variables and arrays are used in programming.
Constants …
…
…
…
Variables …
…
…
…
Arrays …
…
…
…
[6]

Advertisement