Computer Science For First Examination In 2021 9618 · 11

11.3 Structured programming

59 questions in this subtopic. Open a question to solve it and check the official answer.

Reset
2025 October-November · Paper 23 · Q6(a)

Structured programming · 2 marks · official answer ready

(a) A function Generate() is written to take an original number as a parameter and to return the check digit. Outline a test plan that could be used to fully test function Generat…

2025 October-November · Paper 42 · Q2(b)

Structured programming · 3 marks · official answer ready

(b) The procedure PrintArray() takes an integer array as a parameter. The procedure outputs the array contents on a single line with a space between each integer. Write the progra…

2025 October-November · Paper 43 · Q2(b)

Structured programming · 5 marks · official answer ready

2 A program reads string data from a text file into a linear queue and then compresses the data. The queue is created using the global 1D array Queue. The queue can store up to 10…

2025 October-November · Paper 43 · Q9(f)(iii)

Structured programming · 30 marks

(iii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot(s) into part 3(a)(iii) in the evidence document. [1] (b) The program …

2025 May-June · Paper 23 · Q1(a)(i)

Structured programming · 2 marks · official answer ready

(i) State two reasons why the programmer decides to use modules. 1 ................................................................................................................…

2025 May-June · Paper 23 · Q7(a)(i)

Structured programming · 5 marks · official answer ready

(i) Write pseudocode for module UpdateVisit() Assume the customer has made at least one previous visit. ...........................................................................…

2025 May-June · Paper 41 · Q1(b)

Structured programming · 6 marks · official answer ready

(b) The function Enqueue(): • takes an integer as a parameter • checks if the queue is full • returns FALSE if the queue is full • stores the parameter in the next position in the…

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

Structured programming · 5 marks · official answer ready

(c) The procedure StoreData(): • takes two parameters: a 1D array DataToStore and a filename • opens the text file with the filename that is passed as a parameter • appends each i…

2025 May-June · Paper 42 · Q1(d)

Structured programming · 6 marks · official answer ready

(d) The text file StackData.txt stores numbers and mathematical operators. Each number and operator are on a new line in the text file. The mathematical operators used in this pro…

2025 May-June · Paper 42 · Q2(c)

Structured programming · 13 marks · official answer ready

(c) The hash value is calculated from the key field using the formula: Key MOD 200 The function CalculateHash() takes a key field as a parameter and calculates and returns the has…

2025 May-June · Paper 42 · Q2(d)

Structured programming · 17 marks · official answer ready

(d) The procedure InsertIntoHash(): • takes a record of type NewRecord as a parameter • uses CalculateHash() to calculate the hash value for the key field in the record • checks i…

2025 May-June · Paper 43 · Q2(c)

Structured programming · 2 marks · official answer ready

(c) The procedure OutputArray() takes an array of integers as a parameter. The procedure outputs each element in the array from the first element to the last element. The output i…

2025 May-June · Paper 43 · Q4(c)

Structured programming · 3 marks

4 56 67 44 43 32 31 345 45 6 54 1 Save your program as Question2_J25. Copy and paste the program code into part 2(a) in the evidence document. [1] (c) The procedure OutputArray() …

2025 May-June · Paper 43 · Q4(c)(i)

Structured programming · 6 marks

4 56 67 44 43 32 31 345 45 6 54 1 Save your program as Question2_J25. Copy and paste the program code into part 2(a) in the evidence document. [1] (c) The procedure OutputArray() …

2024 October-November · Paper 21 · Q5(b)(i)

Structured programming · 4 marks · official answer ready

(i) The function will: • take an integer value as a parameter • return TRUE if the value is within the range 24 to 37, inclusive • otherwise return FALSE. Complete the table to de…

2024 October-November · Paper 22 · Q2(a)

Structured programming · 6 marks · official answer ready

(a) The function Conceal() will: • take a numeric string as a parameter representing the card number • return a string in which the asterisk character replaces all except the last…

2024 October-November · Paper 22 · Q2(b)(i)

Structured programming · 2 marks · official answer ready

(i) Write pseudocode to declare the array. ........................................................................................................................................…

2024 October-November · Paper 22 · Q2(b)(ii)

Structured programming · 1 mark · official answer ready

(ii) The new procedure Conceal() will write the modified string to the corresponding element in column two. The array CardNumber is passed as a parameter to the new procedure Conc…

2024 October-November · Paper 23 · Q6

Structured programming · 7 marks · official answer ready

6 In some countries, on the third Sunday in March, daylight saving time begins when clocks move forward by one hour. A module AdjustClock() will take an integer parameter represen…

2024 October-November · Paper 41 · Q1(b)(ii)

Structured programming · 3 marks · official answer ready

(ii) The main program: • calls ReadData() and stores the returned array • calls FormatArray() with the returned array and outputs the returned string. Write program code for the m…