Learn Extracted exam questions IGCSE Computer Science 0478_m23_qp_22
0478_m23_qp_22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
2 (a) Four descriptions and five pseudocode statements are shown.
Draw one line to link each description to its most appropriate pseudocode statement. Not all pseudocode statements will be used.
Description Pseudocode statement
a statement to count a statement to total a statement to start a pre-condition loop a statement to start a post-condition loop FOR Count 1 TO 10 Value Value + NewValue WHILE Value > 10 DO Value Value + 1 REPEAT
[4]
(b) Write an algorithm in pseudocode, using a single loop, to output the average of 50 numbers that have been stored in the array Number[] [5]
4 Describe how variables and constants are used in programming [3]
5 A food ordering system is an example of a computer system that is made up of sub-systems.
The food ordering system: • allows the user to enter the details of the food they want to order and to pay for the order • displays food available as pictures or as a list.
Complete the structure diagram for the given parts of the food ordering system. Food ordering system
[4]
3 Describe the purpose of test data. Include an example of a type of test data in your answer. Description Example [3]
6 The energy efficiency of an electrical appliance is the percentage of useful energy out compared with the total energy in.
An algorithm has been written in pseudocode to calculate the energy efficiency of an appliance. Values for total energy in and useful energy out are input. The efficiency is calculated and output as a percentage.
The entry of the number –1 for either value stops the algorithm.
01 REPEAT
02 OUTPUT "Enter total energy in "
03 INPUT TotalEnergyIn
04 OUTPUT "Enter useful energy out "
05 OUTPUT UsefulEnergyOut
06 IF TotalEnergyIn <> -1 AND UsefulEnergy <> -1
07 THEN
08 Efficiency (UsefulEnergyOut / TotalEnergyIn) * 100
09 OUTPUT "Efficiency is ", Efficiency, "%"
10 ENDIF
11 UNTIL TotalEnergyIn <> -1 OR UsefulEnergyOut <> -1
(a) Identify the three errors in the pseudocode and suggest corrections. Error 1 Correction Error 2 Correction Error 3 Correction [3]
(b) Write pseudocode to check for an efficiency of 92% or over for this appliance and to output “A-rated” if the efficiency is 92% or over [2]
7 Consider this logic expression. X = (A OR NOT B) AND (B AND NOT 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 X C
[5]
(b) Complete the truth table from the given 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]
1 Tick (3) one box to show which word accurately describes the scope of a variable declared in a procedure.
A Function
B Global
C Local
D Subroutine
[1]
8 This flowchart represents an algorithm to find the average value of a number of sales. NumberSales NumberSales + 1 NumberSales 0 Total 0 Average Total / NumberSales Total Total + SaleValue IS SaleValue = 0? INPUT SaleValue OUTPUT "Average sale value ", Average No Yes START STOP
(a) Complete the trace table using this data:
5.50, 3.40, 6.25, 3.85, –11.00, 0 NumberSales Total SaleValue Average OUTPUT
[4]
(b) Identify the error in the algorithm and describe how to correct it. Error Correction [3]
9 A shop that sells books has set up a new database table called BookList to store book details. Part of this table is given. CatNo Title Fiction Author PaperBack Price StockLevel BK01 The Princes’ Story Yes B Penn Yes 4.50 500 BK02 The Princesses’ Story Yes B Penn Yes 4.50 350 BK03 Computer Science No Way Yu Yes 19.99 20 BK04 The Modern World No P Patel No 25.00 5 BK05 The Ancient World Yes P Patel No 25.00 5 BK06 Computer Science No R Dale Yes 27.35 8 BK07 The Princes’ Story Yes B Penn No 12.50 3 BK08 The Princesses’ Story Yes B Penn No 12.50 0 BK12 Famous Five Yes E Bly Yes 2.75 45 BK15 Secret Seven Yes E Bly Yes 2.75 25 BK16 The Last Knight Yes P Mann Yes 5.99 7 BK17 The Dark Tower Yes P Mann Yes 5.99 5 BK19 The Final Chase Yes P Mann Yes 5.99 5 BK21 Maths Today Part 1 No B Ward Yes 6.75 25 BK22 Maths Today Part 2 No B Ward Yes 6.75 15 BK23 Maths Today Part 3 No B Ward Yes 6.75 10 BK26 Maths Today Workbook No B Ward Yes 6.75 30 BK27 Knitting for Beginners No A Smith Yes 6.99 3 BK30 Woodwork for Beginners No A Smith Yes 6.99 4 BK31 Networking for Beginners No A Smith Yes 6.99 0
(a) State the number of records in this part of the database table [1]
(b) (i) Give the name of the field that would be used for the primary key [1]
(ii) State the reason for choosing this field for the primary key [1]
(c) Complete the table to identify the most appropriate data type for each field based on the data shown in the table BookList Field Data type CatNo Title Fiction Price
[2]
(d) Write the output from this structured query language (SQL) statement.
SELECT CatNo, Title, Author
FROM BookList
WHERE StockLevel = 0; [2]
(e) Complete this SQL statement to display all the titles by the author B Penn. SELECT FROM WHERE ;
[2]
10 The variables X, Y and Z are used in a program: X stores a whole number, Y stores a decimal number and Z stores a flag that can be set to TRUE or FALSE
(a) Write pseudocode statements to declare the variables X, Y and Z [3]
(b) The function Same(A,B) returns TRUE if the value of A is the same as the value of B when B is rounded to the nearest whole number and FALSE otherwise.
Write pseudocode statements to: • define the function • call the function with X and Y and store the return value in Z Function definition Function call [6]
(c) State the difference between defining and calling a function [1]