0478/23 · May/June 2025
Download PDFThe flowchart shows an algorithm used for quality control on a biscuit production line. The weight of each biscuit is entered into the variable 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 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.
Three uses of arithmetic operators and four results are shown. Draw one line from each use of arithmetic operator to the correct result. Not all results will be used.
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. 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
Identify the line numbers of four errors in the pseudocode and suggest a correction for each error. Error 1 line number ............................... Correction ................................................................................................................................. ................................................................................................................................................... Error 2 line number ............................... Correction ................................................................................................................................. ................................................................................................................................................... Error 3 line number ............................... Correction ................................................................................................................................. ................................................................................................................................................... Error 4 line number ............................... 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 PROCEDURE Swap PROCEDURE Swap(.........................................................................................................) DECLARE Hold : REAL Hold ← Values[ .................................................................................................] ................................................................................................................................... ................................................................................................................................... ENDPROCEDURE
Write the pseudocode to transfer control to PROCEDURE Swap
Explain the difference between global variables and the variable declared in 3(b)(i).
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 ............................................................................................................ Reason .............................................................................................................................. ........................................................................................................................................... Extreme test data .............................................................................................................. Reason .............................................................................................................................. ...........................................................................................................................................
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 meet the requirement. You do not need to declare any variables for this algorithm.
A computer store uses a database table 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.
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. SELECT ........................................................................................................ FROM ................................................................ WHERE .......................................................................................................... ;
This pseudocode represents an algorithm. 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
Complete the trace table for the algorithm, using input data: COMPUTER
Describe the processes in the algorithm.
Draw the symbol for a NOR logic gate and complete the truth table for it.
Consider the rules given in the following table: Input | Binary value | Description L | 0 | dark | 1 | light M | 0 | no motion detected | 1 | motion detected S | 0 | no sound detected | 1 | sound detected 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. A = .....................................................................................................................................
Complete the truth table for the security system.
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 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: Video[1,1] is "Macbeth" Video[1,2] is "digital download" Video[1,3] is "2015" Video[1,4] is "DG276" The two-dimensional (2D) array 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 Video[] to the array Results[]. The search continues and if other videos with the same title are found, this data is also copied to the array Results[]. The search ends when the end of the data is reached. Write a program that meets the following requirements: • The video library array needs to be initialised with the null string (""), allowing for up to 10000 records. The array 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. • 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. • When the user enters a new video, the following data is stored in the first available location of the relevant array: o video title o format (4K Blu-ray disc, standard Blu-ray disc, DVD, digital download) o year of release as string o storage code. • Allow input of data for another video if required. • When searching for an existing video, if a match is found, transfer all the data for that video into the array Results[], and continue to search until all videos with the same title have been found. • Output the results from the array Results[] • If the video title is not found, output a suitable message. • The system returns to the menu after completing the input or the output, until the user chooses to stop. 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.






