Learn Extracted exam questions IGCSE Computer Science 0478_s25_qp_23
0478_s25_qp_23
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
The flowchart shows an algorithm used for quality control on a biscuit production line.
The weight of each biscuit is entered into the variable \texttt{Weight}. If the weight of the biscuit is between 16.2 and 17.2 grammes, inclusive, the pass counter is incremented by 1. Otherwise, the reject counter is incremented by 1. The process continues until --1 is entered, after which, the totals for pass and reject counters are output.
Complete this flowchart.
Explain how you would alter the flowchart in \textbf{1(a)} so that it calculates and outputs the average weight of only the biscuits that passed the weight check.
You may include program statements or flowchart symbols in your answer, but they must be fully explained.
\textbf{Three} uses of arithmetic operators and \textbf{four} results are shown.
Draw \textbf{one} line from each use of arithmetic operator to the correct result. \textbf{Not} all results will be used.
\begin{tabular}{lcl} \textbf{Use of arithmetic operator} & \quad \quad \quad & \textbf{Result} \ & & \ & & \framebox{\makebox[5em]{5}} \ \framebox{\makebox[10em]{\texttt{355 DIV 10}}} & & \ & & \framebox{\makebox[5em]{355}} \ \framebox{\makebox[10em]{\texttt{355 / 10}}} & & \ & & \framebox{\makebox[5em]{35}} \ \framebox{\makebox[10em]{\texttt{355 MOD 10}}} & & \ & & \framebox{\makebox[5em]{35.5}} \ \end{tabular}
The purpose of this pseudocode algorithm is to carry out a bubble sort to sort, in descending order, 1000 numbers stored in a one-dimensional (1D) array.
\begin{alltt} 01 DECLARE Values : ARRAY[1:1000] OF REAL 02 DECLARE Index : CHAR 03 DECLARE Stop : BOOLEAN 04 DECLARE Hold : REAL 05 Stop <- FALSE 06 WHILE NOT Stop DO 07 Stop <- FALSE 08 FOR Index <- 1 TO 50 09 IF Values[Index + 1] > Values[Index] 10 THEN 11 Hold <- Values[Index] 12 Values[Index] <- Values[Index + 1] 13 Values[Index + 1] <- Hold 14 Stop <- FALSE 15 ENDIF 16 NEXT Index 17 NEXT Stop \end{alltt}
Identify the line numbers of \textbf{four} errors in the pseudocode and suggest a correction for each error.
Error 1 line number \hrulefill
Correction
Error 2 line number \hrulefill
Correction
Error 3 line number \hrulefill
Correction
Error 4 line number \hrulefill
Correction
The swap section in lines 11 to 13 of the existing code are to be changed to a call statement for a procedure. This procedure will include two parameters representing the indexes of the array elements to be swapped.
Complete the pseudocode for \texttt{PROCEDURE Swap}
\begin{alltt} PROCEDURE Swap(\hrulefill)
DECLARE Hold : REAL
Hold <- Values[\hrulefill]
\hrulefill
\hrulefill
ENDPROCEDURE \end{alltt}
Write the pseudocode to transfer control to \texttt{PROCEDURE Swap}
Explain the difference between global variables and the variable declared in \textbf{3(b)(i)}.
An input must be an integer between 10 and 95, inclusive.
An input must be an integer between 10 and 95, inclusive.
State the type of validation check to test if the input meets this requirement.
Suggest suitable abnormal and extreme test data for an integer between 10 and 95 inclusive, and give a reason for each of your choices.
Abnormal test data \hrulefill Reason \hrulefill
Extreme test data \hrulefill Reason \hrulefill
A password system requires all new passwords to contain at least 12 characters.
State the type of validation check to test that the password meets this requirement.
Write the pseudocode to allow a new password to be entered and to ensure that it contains at least 12 characters. The password is re-input until it meets this requirement. Use an appropriate error message for inputs that do not \textbf{not} meet the requirement.
You do \textbf{not} need to declare any variables for this algorithm.
A computer store uses a database table \texttt{COMPONENT} to store the stock details of a range of components needed to build computer systems.
Complete the table by giving appropriate data types for each field.
Only the data types: text, character, Boolean, integer, real, date/time are available in this database.
\begin{tabular}{|l|l|l|} \hline \textbf{Field} & \textbf{Data type} & \textbf{Description} \ \hline \texttt{ID} & & unique identifier \ \hline \texttt{Name} & & component name \ \hline \texttt{Description} & & component description \ \hline \texttt{Price} & & selling price of component to 2 decimal places \ \hline \texttt{NumberAvailable} & & number in stock \ \hline \texttt{MinimumLevel} & & level at which the component is reordered \ \hline \texttt{ReOrdered} & & whether or not the component has been reordered \ \hline \texttt{DateOrdered} & & the date the component was reordered \ \hline \end{tabular}
Complete the structured query language (SQL) statement to list only the unique identifier, component name and reorder date of all the components that have been reordered.
\begin{alltt} SELECT \hrulefill
FROM \hrulefill
WHERE \hrulefill ; \end{alltt}
This pseudocode represents an algorithm.
\begin{alltt} DECLARE Store : ARRAY[1:100] OF CHAR DECLARE Word : STRING DECLARE Index : INTEGER DECLARE Letter : CHAR INPUT Word FOR Index <- 1 TO LENGTH(Word) Letter <- SUBSTRING(Word, Index, 1) CASE OF Letter 'A' : Letter <- "" 'E' : Letter <- "" 'I' : Letter <- "" 'O' : Letter <- "" 'U' : Letter <- "" ENDCASE Store[Index] <- Letter NEXT Index FOR Index <- 1 TO LENGTH(Word) IF Store[Index] <> "" THEN OUTPUT Store[Index] ENDIF NEXT Index \end{alltt}
Complete the trace table for the algorithm, using input data: COMPUTER
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline \multicolumn{3}{|c|}{} & \multicolumn{8}{c|}{Store[]} & \ \hline \textbf{Word} & \textbf{Index} & \textbf{Letter} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{} & \textbf{OUTPUT} \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline & & & & & & & & & & & \ \hline \end{tabular}
Describe the processes in the algorithm.
Draw the symbol for a NOR logic gate and complete the truth table for it.
NOR logic gate symbol:
\newline \newline \newline \newline
Truth table:
\begin{tabular}{|c|c|c|} \hline \textbf{A} & \textbf{B} & \textbf{Z} \ \hline 0 & 0 & \ \hline 0 & 1 & \ \hline 1 & 0 & \ \hline 1 & 1 & \ \hline \end{tabular}
Consider the rules given in the following table:
\begin{tabular}{|c|c|l|} \hline \textbf{Input} & \textbf{Binary value} & \textbf{Description} \ \hline \textbf{L} & 0 & dark \ \cline{2-3} & 1 & light \ \hline \textbf{M} & 0 & no motion detected \ \cline{2-3} & 1 & motion detected \ \hline \textbf{S} & 0 & no sound detected \ \cline{2-3} & 1 & sound detected \ \hline \end{tabular}
A security system uses sensors to sound an alarm if an intruder is detected.
The alarm sounding is represented by the output $A = 1$.
The alarm sounds if it is dark and if either motion or sound or both motion and sound are detected.
Write the logic expression for the security system.
\textbf{A} = \hrulefill
Complete the truth table for the security system.
\begin{tabular}{|c|c|c|c|c|} \hline \textbf{L} & \textbf{M} & \textbf{S} & \textbf{Working space} & \textbf{A} \ \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 collector needs a video library system for a collection of videos stored on 4K Blu-ray discs, standard Blu-ray discs, DVD, or as digital downloads.
The two-dimensional (2D) array \texttt{Video[]} is used to store, for each video item, the title, the format of the video (4K Blu-ray disc, standard Blu-ray disc, DVD, or digital download), the year it was released stored as a string and a storage code to represent where the video can be found in the collection, for example:
\begin{alltt} Video[1,1] is "Macbeth" Video[1,2] is "digital download" Video[1,3] is "2015" Video[1,4] is "DG276" \end{alltt}
The two-dimensional (2D) array \texttt{Results[]} is used to store the results of a search to find a specific video. The search uses the video title, and if the video is found, its data is copied from the array \texttt{Video[]} to the array \texttt{Results[]}. The search continues and if other videos with the same title are found, this data is also copied to the array \texttt{Results[]}. The search ends when the end of the data is reached.
Write a program that meets the following requirements:
\begin{itemize} \item The video library array needs to be initialised with the null string (""), allowing for up to 10000 records. The array \texttt{Results[]} must be initialised before every search with the null string and must be able to hold up to 20 search results with the same title. \item Create a menu to add a new video to the library to search for an existing video by title, or to stop, with validation of the input. \item When the user enters a new video, the following data is stored in the first available location of the relevant array: \begin{itemize} \item video title \item format (4K Blu-ray disc, standard Blu-ray disc, DVD, digital download) \item year of release as string \item storage code. \end{itemize} \item Allow input of data for another video if required. \item When searching for an existing video, if a match is found, transfer all the data for that video into the array \texttt{Results[]}, and continue to search until all videos with the same title have been found. \item Output the results from the array \texttt{Results[]} \item If the video title is not found, output a suitable message. \item The system returns to the menu after completing the input or the output, until the user chooses to stop. \end{itemize}
You must use pseudocode or program code and add comments to explain how your code works.
You do \textbf{not} need to declare any arrays, variables or constants. You may assume that this has already been done.
All inputs and outputs must contain suitable messages.