11.3 Structured programming
59 questions in this subtopic. Open a question to solve it and check the official answer.
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…
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…
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…
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 …
Structured programming · 2 marks · official answer ready
(i) State two reasons why the programmer decides to use modules. 1 ................................................................................................................…
Structured programming · 5 marks · official answer ready
(i) Write pseudocode for module UpdateVisit() Assume the customer has made at least one previous visit. ...........................................................................…
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…
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…
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…
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…
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…
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…
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() …
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() …
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…
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…
Structured programming · 2 marks · official answer ready
(i) Write pseudocode to declare the array. ........................................................................................................................................…
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…
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…
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…
