Learn Extracted exam questions IGCSE Computer Science 0478_w23_qp_22
0478_w23_qp_22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
2 A type of validation check is a length check. Another type of validation check is used to make sure that any date entered is in the dd/mm/yyyy style:
dd means day, mm means month and yyyy means year.
(a) State the type of validation check used [1]
(b) Give one example of normal test data and one example of abnormal test data you should use to make sure the check in part (a) is working properly.
State a reason for each of your choices of test data. Normal Reason Abnormal Reason [4]
(c) Describe how a length check could be used with the date entered [2]
1 Tick (✓) one box to complete the sentence.
Verification is used to make sure that a value entered
A has not changed during input.
B is an integer.
C is correct.
D is not a string.
[1]
3 Four pseudocode statements and five pseudocode uses are shown.
(a) Draw one line to link each pseudocode statement to the most appropriate pseudocode use.
Not all pseudocode uses will be required. Pseudocode statement CALL Colour(NewColour) Value (A1 + A2 + A3) / 3 Loop1 Loop1 + 1 IF Count > 7 THEN X1 0 Pseudocode use counting finding an average totalling using a conditional statement using a procedure
[4]
(b) A one‑dimensional (1D) array called Temperatures[] has 25 elements beginning at index 1. It holds values that range between –20 and 100 inclusive.
Write a pseudocode algorithm using a single loop to find the lowest value in this array and output the result only once.
You do not need to declare or populate this array [4]
4 An algorithm has been written in pseudocode to allow the names of 50 cities and their countries to be entered and stored in a two‑dimensional (2D) array. The contents of the array are then output.
01 DECLARE City ARRAY[1:50, 1:2] OF BOOLEAN
02 DECLARE Count : INTEGER
03 DECLARE Out : INTEGER
04 Count 1
05 IF
06 OUTPUT "Enter the name of the city"
07 INPUT City[Count, 2]
08 OUTPUT "Enter the name of the country"
09 INPUT City[Count, 2]
10 Count Count + 1
11 UNTIL Count = 50
12 FOR Out 1 TO 1
13 OUTPUT "The city ", City[Out, 1], " is in ", City[Out, 2]
14 NEXT Out
(a) Identify the four errors in the pseudocode and suggest corrections. Error 1 Correction Error 2 Correction Error 3 Correction Error 4 Correction [4]
(b) Describe the changes you should make to the corrected algorithm to allow the name of a country to be input and to display only the stored cities from that country.
You do not need to rewrite the algorithm [5]
5 Explain how variables and constants should be used when creating and running a program [3]
6 The flowchart represents an algorithm that performs a process on groups of values that are input. The algorithm will fail if the first value of any group is 0.
An input of –1 will terminate the algorithm. START STOP Total 0 Count 0 INPUT Value IS Value = 0 ? IS Value = –1 ? No No Yes Yes Total Total + Value Count Count + 1 Average Total / Count OUTPUT "Total is ", Total OUTPUT "Average is ", Average
(a) Complete the trace table for the input data:
25, 35, 3, 0, 57, 20, 25, 18, 0, –1, 307, 40, 0 Value Average Total Count OUTPUT
[5]
(b) Describe the purpose of the algorithm [2]
7 The string operation SUBSTRING(Quote, Start, Number) returns a string from Quote beginning at position Start that is Number characters long. The first character in Quote is in position 1.
Write pseudocode statements to: • store the string "Learning Never Exhausts The Mind" in Quote • extract and display the words "The Mind" from the string • output the original string in lower case [5]
8 Explain why a programmer would use procedures and parameters when writing a program [4]
9 Consider the logic expression: Z = (A NAND B) OR NOT (B XOR C)
(a) Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify this logic expression.
A B Z C
[4]
(b) Complete the truth table from the given logic expression. A B C Working space Z 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]
10 A database table called Horses stores details about the horses kept at a horse sanctuary. Code Breed BreedOrigin Gender Age Arrived H002 Arabian Saudi Arabia M 5 28/09/2022 H004 Percheron France M 5 30/10/2022 H010 Friesian Netherlands M 6 15/11/2022 H011 Fjord Norway F 4 17/11/2022 H012 Clydesdale Scotland M 10 18/11/2022 H015 Arabian Saudi Arabia F 5 15/12/2022 H016 Arabian Saudi Arabia F 5 15/12/2022 H017 Clydesdale Scotland F 4 16/01/2023 H019 Percheron France M 3 16/01/2023 H025 Percheron France M 7 16/01/2023 H026 Clydesdale Scotland F 9 20/01/2023 H030 Clydesdale Scotland M 12 20/01/2023 H032 Fjord Norway M 3 24/03/2023 H033 Arabian Saudi Arabia F 15 27/04/2023 H034 Clydesdale Scotland F 4 14/06/2023 H035 Fjord Norway M 7 15/06/2023 H036 Friesian Netherlands F 15 20/07/2023 H037 Friesian Netherlands M 12 20/07/2023
(a) State the number of records in this database table [1]
(b) Give the name of the field that is most suitable to be the primary key.
State the reason for this choice. Field Reason [2]
(c) The database only allows the data types: • Boolean • character • date/time • integer • real • text.
Complete the table to show the most appropriate data type for each field.
Each data type must be different. Field Data type Breed Gender Age Arrived
[2]
(d) Complete the structured query language (SQL) to return the code and breed of all the horses whose breed originated in Scotland Code, Breed,
FROM WHERE = "Scotland";
[3]