Learn Extracted exam questions IGCSE Computer Science 0478_s24_qp_22
0478_s24_qp_22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
Tick ($\checkmark$) \textbf{one} box to identify a method used to design and construct a solution to a computing problem.
\textbf{Four} logic functions and \textbf{five} standard symbols for logic gates are shown.
Draw \textbf{one} line to link each logic function to its standard symbol. \textbf{Not} all standard symbols will be used.
\begin{tabular}{cc} \textbf{Logic function} & \textbf{Standard symbol} \ & \ \framebox{\quad AND \quad} & [AND gate symbol] \ & \ \framebox{\quad XOR \quad} & [NOT gate symbol] \ & \ \framebox{\quad NAND \quad} & [NAND gate symbol] \ & \ \framebox{\quad OR \quad} & [XOR gate symbol] \ & \ & [NOR gate symbol] \ \end{tabular}
Identify \textbf{three} different tasks in the analysis stage of the program development life cycle.
- \hrulefill
- \hrulefill
- \hrulefill
A program needs to make sure the characters input for a product code meet these rules:
\begin{itemize} \item The product code is six characters in length. \item The first two characters must be "PD". \item The last four characters must be a number in the range 1000 to 9999 inclusive. \end{itemize}
Identify \textbf{three} validation checks and state how each check would make sure the product code met one of these rules.
Check 1 \hrulefill
Check 2 \hrulefill
Check 3 \hrulefill
The program design will include a pseudocode algorithm. Assume that the product code is stored in the variable \texttt{Product}
Write the pseudocode to make sure that the product code is six characters in length.
Write the pseudocode to make sure that the first two characters of the product code are "PD".
A high-level programming language makes use of arithmetic, Boolean and logical operators.
State how each type of operator is used. Give an example statement, in pseudocode, for each one.
Arithmetic \hrulefill
Example \hrulefill
Boolean \hrulefill
Example \hrulefill
Logical \hrulefill
Example \hrulefill
Totalling and counting are standard methods of solution.
Numbers are input. The number 9999.9 is the last number to be input and is ignored.
Write an algorithm in pseudocode to total the numbers input and to output the total. You do \textbf{not} need to validate the input.
Write an algorithm in pseudocode to count and output the number of input values that are greater than 100. You do \textbf{not} need to validate the input.
An algorithm has been written in pseudocode to find and display the maximum and minimum values in an array of 1000 positive numbers. The array \texttt{List[]} starts at index 1
\begin{alltt} 01 Max <- List 02 Min <- List 03 FOR Counter <- 2 TO 1000 04 IF List[Counter] < Max 05 THEN 06 Max <- List[Counter] 07 ENDIF 08 IF List[Count] < Min 09 THEN 10 Min <- List[Counter] 11 ENDWHILE 12 NEXT Counter 13 OUTPUT "Maximum value is ", Max 14 OUTPUT "Minimum value is ", Min \end{alltt}
Give a line number for each of these types of statement:
Assignment statement \hrulefill Selection statement \hrulefill Iteration statement \hrulefill
Identify the line numbers of the \textbf{three} 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
A logic circuit is to be built to control the opening of a safe used to store money. There are two keys, \textbf{A} and \textbf{B}, and a time switch \textbf{C}. The safe can only open if both keys are used and the time switch is off.
\begin{tabular}{|l|l|c|} \hline key \textbf{A} & not used & 0 \ \cline{2-3} & used & 1 \ \hline key \textbf{B} & not used & 0 \ \cline{2-3} & used & 1 \ \hline time switch \textbf{C} & switch off & 0 \ \cline{2-3} & switch on & 1 \ \hline safe \textbf{X} & safe cannot open & 0 \ \cline{2-3} & safe can open & 1 \ \hline \end{tabular}
Write the logic expression for this problem.
Complete the truth table for this problem.
\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.
The array \texttt{List[1:5]} used in the flowchart contains this data:
\begin{tabular}{|c|c|c|c|c|} \hline \texttt{List} & \texttt{List} & \texttt{List} & \texttt{List} & \texttt{List} \ \hline 15 & 17 & 20 & 5 & 9 \ \hline \end{tabular}
Describe what the algorithm represented by the flowchart is doing.
A television subscription service has a new database table named \texttt{Contract} to store details of their subscribers' contracts. The table contains these fields:
\begin{itemize} \item \texttt{ContractNumber} -- the contract number, for example CT567 \item \texttt{Months} -- the length of the contract in months, for example 6 \item \texttt{EndDate} -- the date the contract finishes, for example 30 November 2024 \item \texttt{News} -- the news service, yes or no \item \texttt{Movie} -- the movie service, yes or no \item \texttt{Sport} -- the sports service, yes or no \item \texttt{Junior} -- the children's service, yes or no. \end{itemize}
Identify the field that will be the most appropriate primary key for this table.
Complete the table to identify the most appropriate data type for these fields in \texttt{Contract}
\begin{tabular}{|l|l|} \hline \multicolumn{1}{|c|}{\textbf{Field}} & \multicolumn{1}{c|}{\textbf{Data type}} \ \hline \texttt{ContractNumber} & \ \hline \texttt{Months} & \ \hline \texttt{EndDate} & \ \hline \texttt{Sport} & \ \hline \end{tabular}
Explain the purpose of these structured query language (SQL) statements.
Statement 1: \texttt{SELECT SUM (Months) FROM Contract;}
Statement 2: \texttt{SELECT COUNT (News) FROM Contract WHERE News;}
Statement 1 \hrulefill
Statement 2 \hrulefill
Complete this SQL statement to find the contract numbers of the subscribers that take both the news and sports services.
\begin{alltt} SELECT \hrulefill
FROM Contract
WHERE \hrulefill AND \hrulefill ; \end{alltt}
A one-player game uses the two-dimensional (2D) array \texttt{Grid[]} to store the location of a secret cell to be found by the player in 10 moves. Each row and column has 5 cells.
At the start of the game: \begin{itemize} \item The program places an 'X' in a random cell (\textbf{not} in \texttt{Grid[1,1]}) and empties all the other cells in the grid. \item The player starts at the top left of the grid. \item The player has 10 moves. \end{itemize}
During the game:
\begin{itemize}
\item The player can move left, right, up or down by one cell and the move must be within the grid.
\item You Win'' is displayed if the player moves to the cell with 'X' and has played 10 moves or less. \item You Lose'' is displayed if the player has made 10 moves without finding the 'X'.
\end{itemize}
Write a program that meets these requirements.
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.