Learn Extracted exam questions IGCSE Computer Science 0478_w24_qp_23
0478_w24_qp_23
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
Tick ($\checkmark$) \textbf{one} box to show which of the following is used to validate data on input.
Tick ($\checkmark$) \textbf{one} box to show a method used to construct a solution to a problem.
Four logic gates and five logic gate symbols are shown.
Draw \textbf{one} line to link each logic gate to its correct symbol. \textbf{Not} all logic gate symbols will be used.
\begin{tabular}{cc} \textbf{Logic gate} & \textbf{Logic gate symbol} \ & \ \framebox{\quad AND \quad} & [Symbol 1] \ & \ \framebox{\quad NAND \quad} & [Symbol 2] \ & \ \framebox{\quad NOR \quad} & [Symbol 3] \ & \ \framebox{\quad XOR \quad} & [Symbol 4] \ & \ & [Symbol 5] \ \end{tabular}
Complete the paragraph about databases. Use terms from the list. You may need to use a term more than once. Some of the terms in the list will \textbf{not} be used.
\begin{itemize} \item fields \item comments \item columns \item constant \item key \item table \item primary key \item program \item records \item rows \item scripts \item database \item validation \item variable \end{itemize}
Database tables consist of \underline{\hspace{1.5em}} and \underline{\hspace{1.5em}}. \newline Rows are \underline{\hspace{1.5em}}. \newline \underline{\hspace{1.5em}} are fields. \newline Structured query language (SQL) \underline{\hspace{1.5em}} are used to query data. \newline A \underline{\hspace{1.5em}} uniquely identifies a record.
One stage of the program development life cycle is the analysis stage.
Identify and describe \textbf{two} other stages of the program development life cycle.
Stage \hrulefill
Description
Stage \hrulefill
Description
An incomplete algorithm has been written in pseudocode to count the number of values stored in an array and to find their average.
Values have been stored in the array starting at \texttt{A}
All the values to be counted are non-zero.
A value of zero in the array indicates there are no more values stored.
\begin{alltt} 01 DECLARE A : ARRAY[1:50] OF INTEGER 02 DECLARE C : INTEGER 03 DECLARE W : INTEGER 04 DECLARE X : INTEGER 05 W <- 0 06 C <- \hrulefill 07 WHILE A[C] <> 0 08 W <- \hrulefill 09 C <- C + 1 10 ENDWHILE 11 X <- \hrulefill \end{alltt}
Complete the given pseudocode algorithm.
Write pseudocode to display, with suitable messages:
\begin{itemize} \item the number of values stored in the array \item the average of those values stored. \end{itemize}
Meaningful identifiers have \textbf{not} been used in this algorithm.
Suggest suitable meaningful identifiers for:
The array
A \hrulefill
The variables
C \hrulefill X \hrulefill W \hrulefill
A programmer is testing a program that requires a positive value between 1 and 100 inclusive to be entered. The range check in the program is to be tested.
Identify \textbf{three} different types of test data to be used.
For each type of test data, give an example of the value(s) to be used and the expected outcome.
Type 1 \hrulefill Example \hrulefill Outcome \hrulefill
Type 2 \hrulefill Example \hrulefill Outcome \hrulefill
Type 3 \hrulefill Example \hrulefill Outcome \hrulefill
A logic circuit is to be built to control the automatic opening of a window. The window \textbf{W} opens if the temperature \textbf{T} is too high, the heater \textbf{H} is off, and the air conditioning \textbf{A} is off.
\begin{tabular}{|l|l|c|} \hline air conditioning \textbf{A} & air conditioning off & 0 \ \cline{2-3} & air conditioning on & 1 \ \hline temperature \textbf{T} & \textbf{not} too high & 0 \ \cline{2-3} & too high & 1 \ \hline heater \textbf{H} & heater off & 0 \ \cline{2-3} & heater on & 1 \ \hline window \textbf{W} & window closed & 0 \ \cline{2-3} & window open & 1 \ \hline \end{tabular}
Complete the truth table for this problem.
\begin{tabular}{|c|c|c|c|} \hline \textbf{A} & \textbf{T} & \textbf{H} & \textbf{W} \ \hline 0 & 0 & 0 & \ \hline 0 & 0 & 1 & \ \hline 0 & 1 & 0 & \ \hline 0 & 1 & 1 & \ \hline 1 & 0 & 0 & \ \hline 1 & 0 & 1 & \ \hline 1 & 1 & 0 & \ \hline 1 & 1 & 1 & \ \hline \end{tabular}
A flowchart checks that values stored in three variables are identical. If they are different, the highest value is stored in all three variables.
Identify \textbf{four} errors in the flowchart and suggest a correction for each error. You may label each error on the diagram with the corresponding error number.
Error 1 \hrulefill Correction \hrulefill
Error 2 \hrulefill Correction \hrulefill
Error 3 \hrulefill Correction \hrulefill
Error 4 \hrulefill Correction \hrulefill
An algorithm has been written in pseudocode to check that a password meets a set of rules.
\begin{alltt} 01 OUTPUT "Please enter password " 02 INPUT Password 03 Accept <- TRUE 04 IF LENGTH(Password) < 8 OR LENGTH(Password) > 20 05 THEN 06 Accept <- FALSE 07 ENDIF 08 IF LCASE(Password) = Password OR UCASE(Password) = Password 09 THEN 10 Accept <- FALSE 11 ENDIF 12 Index <- 1 13 Found <- FALSE 14 WHILE NOT Found AND Accept AND Index < LENGTH(Password) 15 IF SUBSTRING(Password, Index, 1) = '!' 16 THEN 17 Found <- TRUE 18 ENDIF 19 Index <- Index + 1 20 ENDWHILE 21 IF NOT Found 22 THEN 23 Accept <- FALSE 24 ENDIF 25 IF Accept 26 THEN 27 OUTPUT "Accepted" 28 ELSE 29 OUTPUT "Rejected" 30 ENDIF \end{alltt}
Complete the three trace tables using the data shown for each one.
\textbf{Data: MYWORD}
\begin{tabular}{|c|c|c|c|c|} \hline \textbf{Password} & \textbf{Accept} & \textbf{Index} & \textbf{Found} & \textbf{OUTPUT} \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline \end{tabular}
State the rules that the password must meet.
Building materials are sold in bags. A new database table called \texttt{BuildStock} has been set up to store details about the materials for sale. Part of this table is given.
\begin{tabular}{|c|l|c|c|c|c|} \hline \textbf{MtNo} & \textbf{Name} & \textbf{InStock} & \textbf{WeightKg} & \textbf{PricePerBag} & \textbf{NumberBags} \ \hline MT01 & Builders sand & Yes & 50 & 4.50 & 50 \ \hline MT02 & Sharp sand & Yes & 25 & 3.50 & 21 \ \hline MT03 & Red sand & No & 50 & 2.75 & 0 \ \hline MT04 & Cement & No & 25 & 6.85 & 0 \ \hline MT05 & Chippings & Yes & 50 & 35.00 & 50 \ \hline MT06 & Cobbles & No & 75 & 67.35 & 0 \ \hline MT07 & Pebbles small & Yes & 50 & 34.50 & 3 \ \hline MT08 & Pebbles medium & Yes & 25 & 25.50 & 10 \ \hline MT12 & Pebbles large & Yes & 75 & 62.75 & 20 \ \hline MT15 & Washed gravel & Yes & 50 & 12.75 & 12 \ \hline MT16 & Pea gravel & Yes & 100 & 15.95 & 24 \ \hline \end{tabular}
Write the output from this structured query language (SQL) statement.
\begin{alltt} SELECT MtNo, Name FROM BuildStock WHERE WeightKg = 75 ORDER BY PricePerBag; \end{alltt}
Complete this SQL statement to display only the names of all the materials that are out of stock.
\texttt{SELECT} \hrulefill \texttt{FROM} \hrulefill \texttt{WHERE} \hrulefill
Explain how another SQL statement using a different field could be used to display the same information.
Members of a litter picking group complete a litter pick every month. Members' names are stored in one-dimensional (1D) array \texttt{PickerName[]}
Each member stores the weight of the litter they have picked in another one-dimensional (1D) array \texttt{PickedWeight[]} The weights are in kilograms with one decimal place, for example 8.4
The position of each member's data in the two arrays is the same. For example, the member stored at index 10 in \texttt{PickerName[]} and at index 10 in \texttt{PickedWeight[]} is the same.
Every month, there is a small prize awarded to the members of the group who have the two heaviest weights. Certificates are awarded to all members with a pick weight of over three kilograms.
Write a program that meets the following requirements:
\begin{itemize} \item allows the weight of members' picks to be input and validated \item sorts the arrays \texttt{PickedWeight[]} and \texttt{PickerName[]} in descending order of weight \item outputs the member names and the pick weights of the members with the two heaviest picks and identifies them as "Best in Group" and "Second best in Group" \item stores the names of all the members who will receive a certificate in the array \texttt{PickerCertificate[]} \item outputs a message stating the number of certificates to be printed. \end{itemize}
You must use pseudocode or program code \textbf{and} add comments to explain how your code works.
You do \textbf{not} need to declare any arrays or variables; you may assume that this has already been done.
All inputs and outputs must contain suitable messages.
You do \textbf{not} need to initialise the data in the array \texttt{PickerName[]}