Skip to content

Learn Extracted exam questions IGCSE Computer Science 0478_s24_qp_21

0478_s24_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 complete this sentence.

A validation check to make sure that an email address contains an '@' sign is a

  1. A

    range check.

  2. B

    visual check.

  3. C

    presence check.

  4. D

    format check.

2 short_answer p. 2

\textbf{Four} descriptions of programming concepts and \textbf{five} programming concepts are shown.

2a 4 marks short_answer p. 2 8.1

Draw \textbf{one} line to link each description to the most appropriate programming concept.

\textbf{Not} all programming concepts will be used.

\begin{tabular}{ll} \textbf{Description} & \textbf{Programming concept} \ a subroutine that may \textbf{not} return a value & function \ & \ a value that is declared and used within a specific procedure & procedure \ & \ a value that a procedure expects you to supply when it is called & parameter \ & \ a subroutine that will always return a value & global variable \ & \ & local variable \ \end{tabular}

2b 2 marks short_answer p. 2 8.1

Write the pseudocode to use a procedure named \texttt{Average} that passes the values 25 and 50 to the procedure.

2c 3 marks long_answer p. 3 8.1

Outline the role of procedures and functions in creating a program that is easier to maintain.

3 4 marks short_answer p. 3 8.1

State what is meant by the data types integer and real. Give an example of each.

Integer \hrulefill

Example \hrulefill

Real \hrulefill

Example \hrulefill

4 short_answer p. 4

This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered and totalled. The total and average of the entered values are output at the end of the algorithm.

\begin{alltt} 01 DECLARE Loop : STRING 02 DECLARE Limit : INTEGER 03 DECLARE Value : REAL 04 DECLARE Total : REAL 05 Total <- 0 06 Limit <- ROUND(RANDOM() * 19,0) + 1 07 IF Loop <- 1 TO Limit 08 OUTPUT "Enter a number" 09 INPUT Loop 10 Total <- Total * Value 11 NEXT Loop 12 OUTPUT "The total of the numbers entered is ", Total 13 OUTPUT "The average of the numbers entered is ", Total / Limit \end{alltt}

4a 4 marks short_answer p. 4 7

Identify the line numbers of \textbf{four} errors in the pseudocode and suggest corrections.

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

4b 2 marks short_answer p. 4 8.1

Write the pseudocode statement that would output the average calculated in line 13 of the algorithm rounded to \textbf{one} decimal place.

4c 4 marks long_answer p. 5 7

Explain how you should alter the original corrected algorithm to make sure that all the numbers entered are between 1 and 500 inclusive. If any numbers fall outside these limits, a replacement value is requested and entered.

You do \textbf{not} need to re-write the algorithm.

5 5 marks short_answer p. 5 8.1

Write the pseudocode statements to perform this task: \begin{itemize} \item accept the input of a whole number from 1 to 4 inclusive \item use a \texttt{CASE} statement to: \begin{itemize} \item output the number (1 to 4 inclusive) that was entered \item output the word ``ERROR'' if a 1 to 4 inclusive number was \textbf{not} entered. \end{itemize} \end{itemize}

6 short_answer p. 6

The flowchart represents an algorithm.

6a 7 marks short_answer p. 7 7

Complete the trace table for the input data:

7, 47, 50, 52, 60, 80, 63, 70

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline \multicolumn{2}{|c|}{} & \multicolumn{7}{c|}{\textbf{Numbers}} & \multicolumn{4}{c|}{} \ \hline \textbf{Limit} & \textbf{Count} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{Flag} & \textbf{Swap} & \textbf{Result} & \textbf{OUTPUT} \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline & & & & & & & & & & & & \ \hline \end{tabular}

6b 3 marks long_answer p. 8 7

Outline the processes involved in the algorithm shown in the flowchart on page 6.

7 short_answer p. 8
(no root text)
7a 2 marks short_answer p. 8 8.3

Outline why it is useful to store data in a file.

7b 4 marks short_answer p. 8 8.3

The function \texttt{LENGTH(X)} calculates the length of a string \texttt{X}

Write the pseudocode statements to: \begin{itemize} \item read the contents of the text file \texttt{Quotation.txt} into an appropriate string variable that has been declared \item output the string in upper case and the length of the string. \end{itemize}

8 short_answer p. 9

Consider the logic expression:

$$\text{Z} = (\text{R} \text{ OR NOT } \text{T}) \text{ XOR } (\text{NOT } \text{S} \text{ AND } \text{T})$$
8a 5 marks short_answer p. 9 10

Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of \textbf{two} inputs.

Do \textbf{not} simplify this logic expression.

8b 4 marks short_answer p. 9 10

Complete the truth table from the given logic expression.

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

9 short_answer p. 10

A database table called \texttt{SoftDrinks} stores details of the soft drinks sold by a small shop.

\begin{tabular}{|l|l|} \hline \multicolumn{1}{|c|}{\textbf{Field}} & \multicolumn{1}{c|}{\textbf{Example data}} \ \hline \texttt{Name} & Cola \ \hline \texttt{Supplier} & Cambridge Beverages \ \hline \texttt{Container} & Can \ \hline \texttt{SizeCl} & 330 \ \hline \texttt{NumberInStock} & 30 \ \hline \texttt{ReorderLevel} & 15 \ \hline \texttt{Reordered} & Yes \ \hline \end{tabular}

9a 1 mark short_answer p. 10 9

State whether any of the given fields would be suitable as a primary key and give a reason for your answer.

9b 5 marks short_answer p. 10 9

Complete the structured query language (SQL) statement to return the number of cans the shop has in stock.

\begin{alltt} SELECT \underline{\hspace{1.5em}} ( \underline{\hspace{1.5em}} )

FROM \underline{\hspace{1.5em}}

WHERE \underline{\hspace{1.5em}} = \underline{\hspace{1.5em}} ; \end{alltt}

10 15 marks long_answer p. 12 8.2

The one-dimensional (1D) array \texttt{Clubs[]} is used to store the names of 12 cricket clubs in a local sports league.

The two-dimensional (2D) array \texttt{Statistics[]} is used to store, for each cricket club, the number of: \begin{itemize} \item matches won \item matches drawn \item matches lost. \end{itemize}

The 1D array \texttt{Points[]} is used to store the total number of points each cricket club has been awarded.

The position of any cricket club's data is the same in all three arrays. For example, the data in index 2 of \texttt{Statistics[]} and index 2 of \texttt{Points[]} belongs to the cricket club in index 2 of \texttt{Clubs[]}

The variable \texttt{Matches} stores the number of matches played by each team. Each team plays the same number of matches.

Points are awarded for: \begin{itemize} \item a win -- 12 points \item a draw -- 5 points \item a loss -- 0 points. \end{itemize}

Write a program that meets the following requirements: \begin{itemize} \item allows the number of matches played to be input and stored, with a maximum of 22 matches \item validates the number of matches played \item allows the names of the cricket clubs to be input and stored \item allows the number of matches won, drawn and lost to be input and stored for each team \item validates the number of matches won, drawn or lost against the number of matches played \item asks the user to re-enter the number of matches won, drawn or lost if the total does not match the number of matches played \item calculates and stores the total number of points for each club \item finds the cricket club or clubs with the highest number of points \item outputs the name or names of the winning club or clubs, the number of wins and the total number of points awarded. \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.

Log in or create account

IGCSE & A-Level