0478/23 · Oct/Nov 2024
Download PDFFour logic gates and five logic gate symbols are shown. Draw one line to link each logic gate to its correct symbol. Not all logic gate symbols will be used.





Complete the paragraph about databases. Use terms from the list. You may need to use a term more than once. Some of the terms in the list will not be used. fields comments columns constant key table primary key program records rows scripts database validation variable Database tables consist of ...................................... and ...................................... . Rows are ...................................... . ...................................... are fields. Structured query language (SQL) ...................................... are used to query data. A ...................................... uniquely identifies a record.
One stage of the program development life cycle is the analysis stage. Identify and describe two other stages of the program development life cycle. Stage ................................................................................................................................................ Description ....................................................................................................................................... Stage ................................................................................................................................................ Description .......................................................................................................................................
An incomplete algorithm has been written in pseudocode to count the number of values stored in an array and to find their average. Values have been stored in the array starting at A[1] All the values to be counted are non-zero. A value of zero in the array indicates there are no more values stored. 01 DECLARE A : ARRAY[1:50] OF INTEGER 02 DECLARE C : INTEGER 03 DECLARE W : INTEGER 04 DECLARE X : INTEGER 05 W ← 0 06 C ← ................................................................................................. 07 WHILE A[C] <> 0 08 W ← ................................................................................................. 09 C ← C + 1 10 ENDWHILE 11 X ← .................................................................................................
Complete the given pseudocode algorithm.
Write pseudocode to display, with suitable messages: • the number of values stored in the array • the average of those values stored.
Meaningful identifiers have not been used in this algorithm. Suggest suitable meaningful identifiers for: The array A ................................................................................................................................................ The variables C ................................................................................................................................................ X ................................................................................................................................................ W ................................................................................................................................................
A programmer is testing a program that requires a positive value between 1 and 100 inclusive to be entered. The range check in the program is to be tested. Identify three different types of test data to be used. For each type of test data, give an example of the value(s) to be used and the expected outcome. Type 1 .............................................................................................................................................. Example ........................................................................................................................................... Outcome ........................................................................................................................................... Type 2 .............................................................................................................................................. Example ........................................................................................................................................... Outcome ........................................................................................................................................... Type 3 .............................................................................................................................................. Example ........................................................................................................................................... Outcome ...........................................................................................................................................
A logic circuit is to be built to control the automatic opening of a window. The window W opens if the temperature T is too high, the heater H is off, and the air conditioning A is off. Complete the truth table for this problem.
A flowchart checks that values stored in three variables are identical. If they are different, the highest value is stored in all three variables. Identify four errors in the flowchart and suggest a correction for each error. You may label each error on the diagram with the corresponding error number. Error 1 .............................................................................................................................................. Correction ......................................................................................................................................... Error 2 .............................................................................................................................................. Correction ......................................................................................................................................... Error 3 .............................................................................................................................................. Correction ......................................................................................................................................... Error 4 .............................................................................................................................................. Correction .........................................................................................................................................


An algorithm has been written in pseudocode to check that a password meets a set of rules. 01 OUTPUT "Please enter password " 02 INPUT Password 03 Accept ← TRUE 04 IF LENGTH(Password) < 8 OR LENGTH(Password) > 20 05 THEN 06 Accept ← FALSE 07 ENDIF 08 IF LCASE(Password) = Password OR UCASE(Password) = Password 09 THEN 10 Accept ← FALSE 11 ENDIF 12 Index ← 1 13 Found ← FALSE 14 WHILE NOT Found AND Accept AND Index < LENGTH(Password) 15 IF SUBSTRING(Password, Index, 1) = '!' 16 THEN 17 Found ← TRUE 18 ENDIF 19 Index ← Index + 1 20 ENDWHILE 21 IF NOT Found 22 THEN 23 Accept ← FALSE 24 ENDIF 25 IF Accept 26 THEN 27 OUTPUT "Accepted" 28 ELSE 29 OUTPUT "Rejected" 30 ENDIF
Complete the three trace tables using the data shown for each one. Data: MYWORD Data: M!word Data: My!Hidden
State the rules that the password must meet.
Building materials are sold in bags. A new database table called BuildStock has been set up to store details about the materials for sale. Part of this table is given.
| MtNo | Name | InStock | WeightKg | PricePerBag | NumberBags |
|---|---|---|---|---|---|
| MT01 | Builders sand | Yes | 50 | 4.50 | 50 |
| MT02 | Sharp sand | Yes | 25 | 3.50 | 21 |
| MT03 | Red sand | No | 50 | 2.75 | 0 |
| MT04 | Cement | No | 25 | 6.85 | 0 |
| MT05 | Chippings | Yes | 50 | 35.00 | 50 |
| MT06 | Cobbles | No | 75 | 67.35 | 0 |
| MT07 | Pebbles small | Yes | 50 | 34.50 | 3 |
| MT08 | Pebbles medium | Yes | 25 | 25.50 | 10 |
| MT12 | Pebbles large | Yes | 75 | 62.75 | 20 |
| MT15 | Washed gravel | Yes | 50 | 12.75 | 12 |
| MT16 | Pea gravel | Yes | 100 | 15.95 | 24 |
Write the output from this structured query language (SQL) statement. SELECT MtNo, Name FROM BuildStock WHERE WeightKg = 75 ORDER BY PricePerBag;
Complete this SQL statement to display only the names of all the materials that are out of stock. SELECT ............................................................................................................................. FROM .................................................................................................................................. WHERE ...............................................................................................................................
Explain how another SQL statement using a different field could be used to display the same information.
Members of a litter picking group complete a litter pick every month. Members’ names are stored in one-dimensional (1D) array PickerName[] Each member stores the weight of the litter they have picked in another one-dimensional (1D) array PickedWeight[] The weights are in kilograms with one decimal place, for example 8.4 The position of each member’s data in the two arrays is the same. For example, the member stored at index 10 in PickerName[] and at index 10 in PickedWeight[] is the same. Every month, there is a small prize awarded to the members of the group who have the two heaviest weights. Certificates are awarded to all members with a pick weight of over three kilograms. Write a program that meets the following requirements: • allows the weight of members’ picks to be input and validated • sorts the arrays PickedWeight[] and PickerName[] in descending order of weight • outputs the member names and the pick weights of the members with the two heaviest picks and identifies them as “Best in Group” and “Second best in Group” • stores the names of all the members who will receive a certificate in the array PickerCertificate[] • outputs a message stating the number of certificates to be printed. You must use pseudocode or program code and add comments to explain how your code works. You do 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. You do not need to initialise the data in the array PickerName[]






