Programming
258 questions. Open a question to solve it and check the official answer.
Constructs · 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…
Programming basics · 22 marks
(a) Write program code to declare and initialise Queue, QueueHead, QueueTail and NumberItems Save your program as Question2_N25. Copy and paste the program code into part 2(a) in …
Programming basics · 25 marks
(b) The function Enqueue() takes a string as a parameter. The function checks if the queue is full, and returns Boolean FALSE if the queue is full. If the queue is not full, the p…
Programming basics · 23 marks
(c) The function Dequeue() returns the string "False" if the queue is empty. If the queue is not empty, the function returns the next element in the queue. The function updates th…
Programming basics · 25 marks
(d) The text file BinaryData.txt stores individual binary digits, '1' and '0'. Each digit is on a new line. For example, the first line in the text file stores '1', the second lin…
Programming basics · 22 marks
(i) Write program code for the main program to: • call ReadData() • call Compress() • output the content of the compressed string. Save your program. Copy and paste the program co…
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 …
Constructs · 21 marks
(iv) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot(s) into part 3(b)(iv) in the evidence document. [1] 14 15 16 reasonabl…
Structured programming · 2 marks · official answer ready
(i) State two reasons why the programmer decides to use modules. 1 ................................................................................................................…
Constructs · 24 marks
(b) Once the program has been completed, it is tested using the walkthrough method. Describe the walkthrough method and explain how it can be used to identify errors. ............…
Structured programming · 5 marks · official answer ready
(i) Write pseudocode for module UpdateVisit() Assume the customer has made at least one previous visit. ...........................................................................…
Constructs · 1 mark · official answer ready
(ii) The programmer decides to amend the UpdateVisit() module so that loyalty points are further increased if the customer visits the coffee shop the same day of the week as their…
Constructs · 0 marks · official answer ready
(b) Write pseudocode statements to declare the composite data type, Booking, to hold data about taxi bookings. The data required includes: • booking number (any combination of let…
Programming basics · 2 marks · official answer ready
(a) Write the Boolean logic expression that corresponds to the given truth table as the sum-of-products. Z = ......................................................................…
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 · 4 marks · official answer ready
6 Describe the process of executing a program using an interpreter. ...............................................................................................................…
Constructs · 2 marks · official answer ready
8 (a) Describe what is meant by multi-tasking and how it benefits process management. .............................................................................................…
Constructs · 4 marks · official answer ready
(b) Explain the function of the shortest remaining time scheduling routine and give a benefit of this routine. Function ...........................................................…
Constructs · 4 marks · official answer ready
(a) Write pseudocode statements to declare the composite data type VideoLibrary to hold data about each video in the collection. This data includes: • identity code (any combinati…
Programming basics · 2 marks · official answer ready
(a) Write the Boolean logic expression that corresponds to the given truth table as the sum-of-products. Z = ......................................................................…
