Computer Science For First Examination In 2021 9618 · 11

Programming

258 questions. Open a question to solve it and check the official answer.

2023 May-June · Paper 23 · Q6(a)

Structured programming · 7 marks · official answer ready

(a) Write pseudocode for procedure Select(). Parameter validation is not required. ................................................................................................…

2023 May-June · Paper 23 · Q8(a)

Constructs · 8 marks · official answer ready

(a) Write pseudocode for module ChangeSupp(). .....................................................................................................................................…

2023 May-June · Paper 23 · Q8(b)

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…

2023 May-June · Paper 23 · Q8(c)(ii)

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 …

2023 May-June · Paper 31 · Q5(b)

Constructs · 4 marks · official answer ready

(b) Give two benefits and two drawbacks of circuit switching. Benefit 1 ...........................................................................................................…

2023 May-June · Paper 31 · Q10

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…

2023 May-June · Paper 31 · Q11(b)

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 .....................…

2023 May-June · Paper 32 · Q9(c)

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…

2023 May-June · Paper 32 · Q9(d)

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…

2023 May-June · Paper 33 · Q5(b)

Constructs · 4 marks · official answer ready

(b) Give two benefits and two drawbacks of circuit switching. Benefit 1 ...........................................................................................................…

2023 May-June · Paper 33 · Q10

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…

2023 May-June · Paper 33 · Q11(b)

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 .....................…

2023 May-June · Paper 41 · Q1(b)(i)

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…

2023 May-June · Paper 41 · Q1(b)(ii)

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…

2023 May-June · Paper 41 · Q1(d)(i)

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…

2023 May-June · Paper 41 · Q2(b)(ii)

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…

2023 May-June · Paper 41 · Q2(c)

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…

2023 May-June · Paper 41 · Q3(b)(ii)

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…

2023 May-June · Paper 41 · Q3(b)(iii)

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 …

2023 May-June · Paper 41 · Q3(c)

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…