0478/23 · May/June 2024
Download PDF

Four logic gate symbols and five logic functions are shown. Draw one line to link each logic gate symbol to the appropriate logic function. Not all logic functions will be used.
Complete the truth table for this logic circuit.
Describe the characteristics of the string and char data types and give an example of each. String ................................................................................................................................................ .......................................................................................................................................................... Example ........................................................................................................................................... Char ................................................................................................................................................. .......................................................................................................................................................... Example ...........................................................................................................................................
This pseudocode algorithm is intended to allow data for up to 50 people to be entered and stored in a two-dimensional (2D) array. The data is their last name, first name and the city in which they live. 01 DECLARE People : ARRAY[1:50, 1:3] OF REAL 02 DECLARE Count : INTEGER 03 DECLARE Response : CHAR 04 DECLARE Continue : BOOLEAN 05 FOR I ← 1 TO 50 06 FOR J ← 1 TO 3 07 People[I, J] ← "" 08 NEXT J 09 NEXT I 10 Count ← 100 11 Continue ← TRUE 12 CASE OF 13 OUTPUT "Enter the last name" 14 INPUT People[Count, 1] 15 OUTPUT "Enter the first name" 16 INPUT People[Count, 2] 17 OUTPUT "Enter the city" 18 INPUT People[Count, 3] 19 OUTPUT "Do you want to enter another name (Y or N)?" 20 INPUT Response 21 IF Response = 'N' 22 THEN 23 Continue ← FALSE 24 ELSE 25 Count ← Count + 1 26 ENDIF 27 UNTIL NOT Count

Identify the line numbers of the four errors in the pseudocode and suggest corrections. Error 1 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 2 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 3 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 4 line number ................................................................................................................... Correction ................................................................................................................................. ...................................................................................................................................................
Write the pseudocode that you could add to the end of this algorithm to output the contents of the array. Make sure that the output ends when the data in the array ends.
Explain how you could alter the original corrected algorithm to make sure that the number of elements being added to the array does not exceed the maximum size of the array (50 elements).
The flowchart represents an algorithm.
Complete the trace table for the input data: 10, 30, 18, 8, 25, 12, 17, 2, 50, 15, 5
Outline the purpose of the algorithm.
Explain why the identifiers L, S, T and A may not be appropriate to use as identifiers and how they could be improved.
State a more appropriate identifier for each of the variables L, S, T and A
A program is to be written that will accept integers that are between the values of 1 and 80 inclusive.
Give examples of normal, abnormal and extreme test data that could be used to make sure the program only accepts valid data. Normal test data ....................................................................................................................... Abnormal test data ................................................................................................................... Extreme test data .....................................................................................................................
Describe what is meant by extreme test data.
The string operation SUBSTRING(FullText, X, Y) returns a string from FullText beginning at position X that is Y characters long. The first character in FullText is in position 1. Write the pseudocode statements to: • store the string “IGCSE Computer Science at Cambridge” in FullText • extract and display the words “Computer Science” from the string and store it in a suitable variable • output the original string in upper case.
Write the pseudocode statements to: • store the content of the variable you created in part (a) to a text file named "Subjects.txt" • close the text file at the end of the algorithm.
A database table called Hangar1 stores details of a collection of historic aircraft at a museum.
| ID | Make | Model | Year | Engines | Airworthy |
|---|---|---|---|---|---|
| JM1 | Hawker Siddeley | Nimrod | 1966 | 4 | Y |
| JM2 | Douglas | DC-10 | 1970 | 3 | Y |
| JM3 | Aérospatiale-BAC | Concorde | 1973 | 4 | N |
| PB1 | De Havilland | DH-9 | 1918 | 1 | Y |
| PB2 | Hawker | Fury | 1935 | 1 | Y |
| PB3 | Hawker | Nimrod | 1934 | 1 | Y |
| PM1 | Fieseler | Storch | 1942 | 1 | N |
| PM2 | Hawker | Hurricane | 1942 | 1 | Y |
| PM3 | Supermarine | Spitfire | 1942 | 1 | N |
| PM4 | Douglas | C-47 Dakota | 1942 | 2 | N |
| PS1 | Boeing | 314 Clipper | 1936 | 4 | N |
State the number of fields and records in the database table. Fields ........................................................................................................................................ Records ....................................................................................................................................
Give the output that would be produced by the structured query language (SQL) statement: SELECT Model, Year, Engines FROM Hangar1 WHERE Engines > 1 ORDER BY Year;
Complete the SQL statement to display only the ID and model of all the aircraft that are airworthy. SELECT ID, ............................................................................................................................ ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................ ;
A one-dimensional (1D) array Teams[] contains the names of 10 football teams in a local league. A two-dimensional (2D) array Results[] stores, for each team, the total number of: • games won • games drawn • games lost • points. The position of any team’s data is the same in both arrays. For example the data in index 3 of Results[] belongs to the team in index 3 of Teams[] The array data will be used to find the current leader of the league. The variable Played stores the number of games played by each team. Each team plays the same number of games. Write a program that meets the following requirements: • allows the number of games played to be input and stored, with a maximum of 18 games • allows the names of the teams to be input and stored • allows the number of games won, drawn and lost to be input and stored for each team • validates the number of games played and the number of games won, drawn or lost against the number of games played • calculates and stores the number of points for each team using three points for a win and one point for a draw; there are no points for a loss • sorts the array Results[] into descending order of number of points, ensuring the corresponding parallel array Teams[] is kept in the same order • determines how many teams have the highest number of points • outputs the name(s) of the winning team(s) along with the number of points achieved. You must use pseudocode or program code and add comments to explain how your code works. You do 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.






