Programming
258 questions. Open a question to solve it and check the official answer.
Structured programming · 7 marks · official answer ready
(a) Write pseudocode for procedure Select(). Parameter validation is not required. ................................................................................................…
Constructs · 8 marks · official answer ready
(a) Write pseudocode for module ChangeSupp(). .....................................................................................................................................…
Constructs · 6 marks · official answer ready
(b) A new module is required: Module Description Report_1() • takes a parameter of type string that represents a SupplierCode • searches the Stock.txt file for each line of item i…
Constructs · 3 marks · official answer ready
(ii) The algorithm will be modified to produce the report in the new format. The modified algorithm will be implemented so that the file Stock.txt is only read once. Describe the …
Constructs · 4 marks · official answer ready
(b) Give two benefits and two drawbacks of circuit switching. Benefit 1 ...........................................................................................................…
Constructs · 5 marks · official answer ready
10 The pseudocode algorithm shown copies an active accounts text file ActiveFile.txt to an archive accounts text file ArchiveFile.txt, one line at a time. Any blank lines found in…
Constructs · 4 marks · official answer ready
(b) Complete the following pseudocode for the function Dequeue to remove the front item from the queue. FUNCTION Dequeue RETURNS STRING DECLARE Item : STRING .....................…
Programming basics · 2 marks · official answer ready
9 This truth table represents a logic circuit. INPUT OUTPUT A B C D Z 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0…
Programming basics · 2 marks · official answer ready
9 This truth table represents a logic circuit. INPUT OUTPUT A B C D Z 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0…
Constructs · 4 marks · official answer ready
(b) Give two benefits and two drawbacks of circuit switching. Benefit 1 ...........................................................................................................…
Constructs · 5 marks · official answer ready
10 The pseudocode algorithm shown copies an active accounts text file ActiveFile.txt to an archive accounts text file ArchiveFile.txt, one line at a time. Any blank lines found in…
Constructs · 4 marks · official answer ready
(b) Complete the following pseudocode for the function Dequeue to remove the front item from the queue. FUNCTION Dequeue RETURNS STRING DECLARE Item : STRING .....................…
Structured programming · 3 marks · official answer ready
(i) The procedure PrintArray() takes an integer array as a parameter and outputs the contents of the array in the order they are stored. The items are printed on the same line, fo…
Structured programming · 1 mark · official answer ready
(ii) Amend the main program to output the contents of DataArray using the procedure PrintArray() Save your program. Copy and paste the program code into part 1(b)(ii) in the evide…
Programming basics · 4 marks · official answer ready
(i) Amend the main program to: • prompt the user to input a whole number between 0 and 100 inclusive • read and validate the input from the user • call LinearSearch() with DataArr…
Constructs · 4 marks · official answer ready
(ii) The Helicopter method IncreaseSpeed() overrides the method from the parent class and: • adds the amount of vertical change to the vertical position • adds IncreaseAmount to t…
Constructs · 3 marks · official answer ready
(c) A procedure needs to output the horizontal position and speed of a vehicle. If the vehicle is a helicopter, it also outputs the vertical position. All outputs must include app…
Structured programming · 3 marks · official answer ready
(ii) Study the pseudocode function PopAnimal(): FUNCTION PopAnimal() RETURNS STRING DECLARE ReturnData : STRING IF AnimalTopPointer = 0 THEN RETURN "" ELSE ReturnData Animal[Anima…
Constructs · 5 marks · official answer ready
(iii) The procedure ReadData(): • reads the animal names from the file AnimalData.txt • uses PushAnimal() to insert each name onto the stack • uses appropriate exception handling …
Constructs · 5 marks · official answer ready
(c) The procedure OutputItem(): • pops the next item from both Animal and Colour • outputs the colour and animal on one line, for example "black horse" If there is no data in Colo…
