Programming
258 questions. Open a question to solve it and check the official answer.
Programming basics · 2 marks · official answer ready
(ii) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products. [2]
Constructs · 2 marks · official answer ready
(c) Describe two ways in which the performance of a sort routine is affected by the data to be sorted. 1 ..........................................................................…
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…
Programming basics · 2 marks · official answer ready
(ii) Test your program. Input the text "TheData.txt" when prompted. Take a screenshot of the output(s) and a screenshot showing the content of the file that stores the red numbers…
Constructs · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 3(e)(ii) in the evidence document. [1] 10 11 12 Permission t…
Constructs · 4 marks · official answer ready
(c) The function Pop() returns the next item from the stack. The function returns "–1" if the stack is empty. Write program code for Pop() Save your program. Copy and paste the pr…
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…
Constructs · 0 marks · official answer ready
(e) The values stored in the stack are used to perform mathematical operations. A total is initialised to the first value in the stack. The first value in the stack will always be…
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…
Constructs · 2 marks · official answer ready
(iii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 3(d)(iii) in the evidence document. [2] Permission to repro…
Constructs · 6 marks · official answer ready
(d) The text file QueueData.txt stores positive integers. Each integer is on a new line in the file. The procedure CreateQueue(): • opens the file QueueData.txt • reads in each li…
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…
Constructs · 2 marks · official answer ready
(ii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 3(c)(ii) in the evidence document. [2] 11 12 Permission to r…
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() …
Constructs · 2 marks · official answer ready
(b) Identify two differences between general purpose registers and special purpose registers. 1 ...................................................................................…
Constructs · 2 marks · official answer ready
(a) The pseudocode contains a logical error. Identify the error and suggest a correction. Error ...................................................................................…
Constructs · 1 mark · official answer ready
(i) Identify a more appropriate way of representing the tax rate values in the final program. .....................................................................................…
