Learn Extracted exam questions IGCSE Computer Science 0478_m24_qp_22
0478_m24_qp_22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
Tick (\checkmark) \textbf{one} box to show which task is part of the analysis stage of the program life cycle.
Four test data types and five descriptions are shown.
Draw \textbf{one} line to link each test data type to its most appropriate description.
\textbf{Test data type} \begin{itemize} \item abnormal \item boundary \item extreme \item normal \end{itemize}
\textbf{Description} \begin{itemize} \item a value that is accepted \item a value that is the highest or lowest value to be accepted and the corresponding lowest or highest value to be rejected \item a value that is the highest or lowest value to be rejected \item a value that is rejected \item a value that is the highest or lowest value to be accepted \end{itemize}
An algorithm has been written to test if an integer that is input is in the range 5 to 10 inclusive. Identify an example of suitable test data for each test data type.
Abnormal \hrulefill Boundary \hrulefill Extreme \hrulefill Normal \hrulefill
A linear search and a bubble sort are standard methods of solution. Fifty numbers are already stored in the array \texttt{Values[1:50]}
Write an algorithm in pseudocode to input a number, \texttt{MyNumber}, and use a linear search to test if that number is stored in the array. If the number is found in the array, the position in the array is output. If the number is not found in the array, "Not found" is output.
Write an algorithm in pseudocode to sort the array \texttt{Values[1:50]} into ascending order using a bubble sort.
Identify \textbf{three} data types used in programming.
- \hrulefill
- \hrulefill
- \hrulefill
An algorithm has been written in pseudocode to calculate the profit when an item is sold. Values for cost price and selling price are input, the profit is calculated (selling price – cost price) and output. The input of zero for either value stops the algorithm.
\begin{alltt} 01 REPEAT 02 OUTPUT "Enter cost price " 03 INPUT Cost 04 OUTPUT "Enter selling price " 05 OUTPUT Sell 06 IF Cost <> 0 OR Sell <> 0 07 THEN 08 Profit <- Sell - Cost 09 OUTPUT "Profit is ", Profit 10 NEXT 11 UNTIL Cost = 0 OR Sell = 0 \end{alltt}
Identify the line numbers of three 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
This algorithm needs to be improved with a range check.
Write pseudocode to reject the input of values less than zero for variables \texttt{Cost} and \texttt{Sell}.
Describe \textbf{two} other validation checks that should be included in this algorithm.
Check 1 \hrulefill Check 2 \hrulefill
Describe \textbf{two} types of iteration that a programmer can use whilst writing a program.
Consider the logic expression:
Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two inputs. Do not simplify this logic expression.
Complete the truth table from the given logic expression.
\begin{tabular}{|c|c|c|c|c|} \hline \textbf{A} & \textbf{B} & \textbf{C} & \textbf{Working space} & \textbf{X} \ \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}
This flowchart represents an algorithm to find the average size of groups of visitors to an attraction.
Complete the trace table using this data:
7, 10, 2, 8, 3, 9, 0, 6
\begin{tabular}{|c|c|c|c|c|} \hline \textbf{NumberGroups} & \textbf{Total} & \textbf{GroupSize} & \textbf{Average} & \textbf{OUTPUT} \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline & & & & \ \hline \end{tabular}
A storage unit rental company wants to set up a new database table for the storage units that can be rented.
The table is called \texttt{StorageUnits} and needs to store these details: \begin{itemize} \item \texttt{SizeMetres} – size in square metres \item \texttt{Position} – first, second or third floor \item \texttt{Hoist} – whether there is a hoist available for the transfer of items \item \texttt{PriceMonth} – the price in dollars for a month's rental \item \texttt{StorageID} – the code to identify each storage unit, for example S123 \end{itemize}
Give the name of the field that would be used for the primary key.
State the reason for choosing this field for the primary key.
Complete the table to identify the most appropriate data type for these fields in the table \texttt{StorageUnits}.
\begin{tabular}{|l|l|} \hline \textbf{Field} & \textbf{Data type} \ \hline \texttt{SizeMetres} & \ \hline \texttt{Position} & \ \hline \texttt{Hoist} & \ \hline \texttt{StorageID} & \ \hline \end{tabular}
Complete this structured query language (SQL) statement to display only the storage code, price and size in square metres of all the storage units where there is a hoist available.
\texttt{SELECT} \hrulefill
\texttt{FROM} \hrulefill
\texttt{WHERE} \hrulefill ;
A programmer has written a program that will be maintained by another programmer. Explain how the program can be written to make sure it can be easily maintained by the other programmer.
Students in a class are recording the amount of time in minutes spent in front of a screen for each day of the week.
The one-dimensional (1D) array \texttt{StudentName[]} contains the names of the students in the class.
The two-dimensional (2D) array \texttt{ScreenTime[]} is used to input the number of minutes on each day spent in front of a screen.
The position of each student's data in the two arrays is the same. For example, the student stored at index 10 in \texttt{StudentName[]} and \texttt{ScreenTime[]} is the same.
The variable \texttt{ClassSize} contains the number of students in the class.
Write a program that meets these requirements:
\begin{itemize} \item allows all the students to enter their daily minutes of screen times for the past week \item calculates the total number of minutes of screen time for each student in the week \item counts, for each student, the number of days with more than 300 minutes of screen time \item calculates the average weekly minutes of screen time for the whole class \item finds the student with the lowest weekly minutes of screen time \item outputs for each student: \begin{itemize} \item name \item total week's screen time in hours and minutes \item number of days with more than 300 minutes of screen time \end{itemize} \item outputs the average weekly minutes of screen time for the whole class \item outputs the name of the student with the lowest weekly screen time. \end{itemize}
You must use pseudocode or program code \textbf{and} add comments to explain how your code works. All inputs and outputs must contain suitable messages.
Assume that the array \texttt{StudentName[]} and the variable \texttt{ClassSize} already contain the required data.
You do not need to declare any arrays or variables; you may assume that this has already been done.