Skip to content

Learn Extracted exam questions IGCSE Computer Science 0478_w24_qp_21

0478_w24_qp_21

Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.

1 1 mark multiple_choice p. 2 7

Tick ($\checkmark$) \textbf{one} box to show which check is used for verification when data is input.

  1. A

    length check

  2. B

    range check

  3. C

    type check

  4. D

    visual check

2 1 mark multiple_choice p. 2 10

Tick ($\checkmark$) \textbf{one} box to identify which option is used to show the inputs and output of a Boolean expression.

  1. A

    flowchart

  2. B

    trace table

  3. C

    truth table

  4. D

    variable

3 4 marks short_answer p. 2 8.1

Four operators and \textbf{three} types of operator are shown.

Draw \textbf{one or more} lines from each operator to its correct operator type.

\textbf{Operators} \begin{itemize} \item \texttt{>=} \item \texttt{AND} \item \texttt{DIV} \item \texttt{+} \end{itemize}

\textbf{Operator types} \begin{itemize} \item Boolean \item Arithmetic \item Logical \end{itemize}

4 3 marks short_answer p. 3 7

Identify \textbf{three} stages of the program development life cycle from the following list of words.

\begin{itemize} \item analysis \item decomposition \item design \item input \item pseudocode \item testing \item variable \end{itemize}

  1. \hrulefill
  2. \hrulefill
  3. \hrulefill
5 6 marks long_answer p. 3 7

Describe \textbf{three} methods that are used to design and construct a solution to a problem.

Method 1 \hrulefill

Method 2 \hrulefill

Method 3 \hrulefill

6 short_answer p. 4

An incomplete algorithm has been written in pseudocode to count the number of zeros stored in an array and total the non-zero values.

\begin{alltt} 01 DECLARE A[1:50] : INTEGER 02 DECLARE C : INTEGER 03 DECLARE I : INTEGER 04 DECLARE T : INTEGER 05 I <- 0 06 \hrulefill 07 FOR C <- 1 TO 50 08 IF A[C] \hrulefill 09 THEN 10 T <- T + 1 11 ELSE 12 I <- I + A[C] 13 ENDIF 14 \hrulefill \end{alltt}

6a 3 marks short_answer p. 4 7

Complete the given pseudocode algorithm.

6b 3 marks short_answer p. 4 7

Write the pseudocode to display, with suitable messages, the number of zeros stored in the array and the total of the non-zero values.

6c 3 marks short_answer p. 4 7

Meaningful identifiers have not been used in the algorithm. Suggest suitable meaningful identifiers for:

The array:

A \hrulefill

The variables:

T \hrulefill C \hrulefill I \hrulefill

7 short_answer p. 5

Consider the logic circuit:

7a 3 marks short_answer p. 5 10

Write a logic expression for the given logic circuit. Do not attempt to simplify the logic expression.

W = \hrulefill

7b 4 marks short_answer p. 5 10

Complete the truth table from the given logic circuit.

\begin{tabular}{|c|c|c|c|c|} \hline \textbf{X} & \textbf{Y} & \textbf{Z} & \textbf{Working space} & \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}

8 short_answer p. 6

A programmer is designing a program to check the length of a password and to check if the password input is the same as the stored password.

The program requirements are: \begin{itemize} \item input the password, \texttt{Password} \item check if there are at least 8 characters in the password \item check that the password is \textbf{not} the same as the stored password \texttt{OldPass} \item output ‘accepted’ if both tests are completed successfully \item otherwise, output ‘rejected’. \end{itemize}

Use the variable names given.

8a 6 marks short_answer p. 6 7

Complete the flowchart for the program.

8b 3 marks short_answer p. 7 8.3

The accepted password, \texttt{Password}, is to be written to the file \texttt{MyPassword.txt}

Write pseudocode to:

\begin{itemize} \item open the file \item write the accepted password to the file \item close the file. \end{itemize}

8c 2 marks long_answer p. 7 8.3

Explain why the accepted password needs to be stored in a file.

9 short_answer p. 8

An algorithm has been written in pseudocode to check if a temperature is in a given range. The temperature values used in the algorithm are correct.

\begin{alltt} 01 REPEAT 02 OUTPUT "Please enter temperature " 03 INPUT Temp 04 IF Temperature = 999 05 THEN 06 IF Temperature > 38.0 07 THEN 08 OUTPUT "Temperature too high" 09 ENDIF 10 IF Temperature < 35.0 11 THEN 12 OUTPUT "Temperature too low" 13 ENDIF 14 IF Temperature >= 35.0 OR Temperature <= 38.0 15 THEN 16 OUTPUT "Temperature normal" 17 ENDIF 18 ENDIF 19 WHILE Temperature = 999 \end{alltt}

9a 4 marks short_answer p. 8 7

Identify the line numbers of \textbf{four} errors in the pseudocode and suggest a correction for each error.

Error 1 line number \hrulefill Correction \hrulefill

Error 2 line number \hrulefill Correction \hrulefill

Error 3 line number \hrulefill Correction \hrulefill

Error 4 line number \hrulefill Correction \hrulefill

9b 2 marks short_answer p. 9 7

Identify the temperature range used.

9c 2 marks short_answer p. 9 7

Complete the trace table for the \textbf{corrected} algorithm using this data:

34.22, 36.1, 37.4, 38.0, 999, –1

\begin{tabular}{|p{4cm}|p{6cm}|} \hline \textbf{Temperature} & \textbf{OUTPUT} \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline & \ \hline \end{tabular}

10 short_answer p. 10

A shop that sells cheese has set up a new database table called \texttt{CheeseStock} to store details of the cheeses available for sale. Part of this table is given.

\begin{tabular}{|c|l|c|c|c|c|} \hline \textbf{ChNo} & \textbf{Name} & \textbf{InStock} & \textbf{SupplierCode} & \textbf{PricePerKg} & \textbf{WeightKg} \ \hline CH01 & American & Yes & XYZ & 4.50 & 20.0 \ \hline CH02 & Brie & Yes & XYZ & 7.50 & 21.0 \ \hline CH03 & Burrata & No & IMP & 13.75 & 0.0 \ \hline CH04 & Camembert & No & ABC & 16.85 & 0.0 \ \hline CH05 & Cheddar & Yes & ABC & 5.00 & 50.0 \ \hline CH06 & Comté & No & SPC & 7.35 & 0.0 \ \hline CH07 & Cottage & Yes & XYZ & 4.50 & 3.0 \ \hline CH08 & Cream & Yes & XYZ & 5.50 & 6.5 \ \hline CH12 & Emmental & Yes & IMP & 2.75 & 1.5 \ \hline CH15 & Feta & Yes & IMP & 12.75 & 12.0 \ \hline CH16 & Fontina & Yes & SPC & 15.99 & 1.2 \ \hline CH17 & Gorgonzola & Yes & SPC & 15.25 & 0.3 \ \hline CH19 & Gouda & Yes & SPC & 7.99 & 2.5 \ \hline CH21 & Gruyère & No & SPC & 16.75 & 0.0 \ \hline CH22 & Halloumi & Yes & IMP & 4.75 & 15.0 \ \hline CH23 & Havarti & No & SPC & 6.75 & 0.0 \ \hline CH27 & Manchego & No & IMP & 13.99 & 0.0 \ \hline CH30 & Manouri & No & IMP & 18.50 & 0.0 \ \hline CH31 & Mascarpone & No & SPC & 12.99 & 0.0 \ \hline \end{tabular}

10a 1 mark short_answer p. 10 9

State the number of records in this part of the database table.

10b short_answer p. 10
10bi 1 mark short_answer p. 10 9

Give the name of the field that would be used for the primary key.

10bii 1 mark short_answer p. 10 9

State the reason for choosing this field for the primary key.

10c 2 marks short_answer p. 11 9

Write the output from this structured query language (SQL) statement.

\begin{alltt} SELECT ChNo, WeightKg FROM CheeseStock WHERE SupplierCode = 'ABC'; \end{alltt}

10d short_answer p. 11
(no root text)
10di 3 marks short_answer p. 11 9

Complete this SQL statement to display only the name of all the cheeses that are out of stock.

\texttt{SELECT} \hrulefill

\texttt{FROM} \hrulefill

\texttt{WHERE} \hrulefill ;

10dii 2 marks long_answer p. 11 9

Explain how \textbf{one} of the lines in your statement in part \textbf{(d)(i)} could be changed to display the same information.

11 15 marks long_answer p. 12 8.2

A running club has 200 members who compete in a 1-kilometre running competition every month. Members’ names are stored in the one-dimensional (1D) array \texttt{MemberName[]} Each member’s time, in seconds, for the 1-kilometre run will be stored in another one-dimensional (1D) array \texttt{MemberTime[]} The position of each member’s data in the two arrays is the same. For example, the member stored at index 10 in \texttt{MemberName[]} and at index 10 in \texttt{MemberTime[]} is the same.

The running club awards a small prize to the members who have the top three times. The club also awards certificates to all members with a time under 240 seconds.

Write a program that meets the following requirements:

\begin{itemize} \item allows members’ times to be input twice and verifies that the inputs match \item sorts the arrays \texttt{MemberTime[]} and \texttt{MemberName[]} in ascending order of time \item outputs the member names and times of the members with the top three times and identifies them as First, Second and Third \item stores the names of all the members who will receive a certificate in the array \texttt{MemberCertificate[]} \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 not need to initialise the data in the array \texttt{MemberName[]}

You do 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.

Log in or create account

IGCSE & A-Level