Learn Extracted exam questions IGCSE Computer Science 0478_s23_qp_22
0478_s23_qp_22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
4 A program needs to make sure the value input for a measurement meets the following rules: • the value is a positive number • a value is always input • the value is less than 1000.
(a) Describe the validation checks that the programmer would need to use [3]
(b) The program needs editing to include a double entry check for the value input.
(i) State why this check needs to be included [1]
(ii) The input value needs to be stored in the variable Measurement
Write pseudocode to perform the double entry check until a successful input is made [3]
3 Identify three different ways that the design of a solution to a problem can be presented. 1 2 3 [3]
1 Tick (✓) one box to identify the first stage of the program development life cycle.
A Analysis
B Coding
C Design
D Testing
[1]
5 Due to an issue with Question 5, the question has been removed from the question paper.
6 State three different features of a high‑level programming language that a programmer could use to make sure that their program will be easier to understand by another programmer.
Give an example for each feature. Feature 1 Example Feature 2 Example Feature 3 Example [6]
7 An algorithm has been written in pseudocode to calculate a check digit for a four‑digit number. The algorithm then outputs the five‑digit number including the check digit.
The algorithm stops when –1 is input as the fourth digit.
01 Flag FALSE
02 REPEAT
03 Total 0
04 FOR Counter 1 TO 4
05 OUTPUT "Enter a digit ", Counter
06 INPUT Number[Counter]
07 Total Total + Number * Counter
08 IF Number[Counter] = 0
09 THEN
10 Flag TRUE
11 ENDIF
12 NEXT Counter
13 IF NOT Flag
14 THEN
15 Number[5] MOD(Total, 10)
16 FOR Counter 0 TO 5
17 OUTPUT Number[Counter]
18 NEXT
19 ENDIF
20 UNTIL Flag
(a) Give the line number(s) for the statements showing: Totalling Count‑controlled loop Post‑condition loop [3]
(b) Identify the three errors in the pseudocode and suggest a correction for each error. Error 1 Correction Error 2 Correction Error 3 Correction [3]
(c) The algorithm does not check that each input is a single digit.
Identify the place in the algorithm where this check should occur.
Write pseudocode for this check.
Your pseudocode must make sure that the input is a single digit and checks for –1 Place in algorithm Pseudocode [4]
8 Consider this logic expression. X = (A OR B) AND (NOT B AND C)
Complete the truth table for this logic expression. A B C Working space X 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
[4]
9 This flowchart represents an algorithm. No No No Yes Yes Yes IS X[C] < X[C + 1]? F 0 C 1 T X[C] X[C] X[C + 1] X[C + 1] T F 1 C C + 1 START STOP IS C = 5? IS F = 0?
(a) The array X[1:5] used in the flowchart contains this data: X[1] X[2] X[3] X[4] X[5] 10 1 5 7 11
Complete the trace table by using the data given in the array. F C X[1] X[2] X[3] X[4] X[5] T 10 1 5 7 11
[5]
(b) Describe what the algorithm represented by the flowchart is doing [2]
2 Four logic gates and five standard symbols for logic gates are shown.
Draw one line to link each logic gate to its standard symbol. Not all standard symbols will be used. AND OR NAND NOT Logic gate Standard symbol
[4]
10 A music streaming service has a new database table named Songs to store details of songs available for streaming. The table contains the fields: • SongNumber – the catalogue number, for example AG123 • Title – the title of the song • Author – the name of the song writer(s) • Singer – the name of the singer(s) • Genre – the type of music, for example rock • Minutes – the length of the song in minutes, for example 3.75 • Recorded – the date the song was recorded.
(a) Identify the field that will be the most appropriate primary key for this table [1]
(b) Complete the table to identify the most appropriate data type for the fields in Songs Field Data type SongNumber Title Recorded Minutes
[2]
(c) Explain the purpose of the structured query language (SQL) statements.
SUM (Minutes) FROM Songs WHERE Genre = "rock";
COUNT (Title) FROM Songs WHERE Genre = "rock"; [3]
11 The variables P and Q are used to store data in a program. P stores a string. Q stores a character.
(a) Write pseudocode statements to declare the variables P and Q, store "The world" in P and store 'W' in Q [2]
(b) Write a pseudocode algorithm to: • convert P to upper case • find the position of Q in the string P (the first character in this string is in position 1) • store the position of Q in the variable Position [4]
(c) Give the value of Position after the algorithm has been executed with the data in question 11(a) [1]