11.1 Programming basics
58 questions in this subtopic. Open a question to solve it and check the official answer.
Programming basics · 5 marks · official answer ready
(a) One part of the program contains an algorithm which is represented by a state-transition diagram. The table shows the inputs, outputs and states for the algorithm: Current sta…
Programming basics · 5 marks · official answer ready
(a) One part of the program contains an algorithm which is represented by a state-transition diagram. The table shows the inputs, outputs and states for the algorithm: Current sta…
Programming basics · 2 marks · official answer ready
(ii) Write pseudocode to input a new data item and add it to the stack using Push(). ..............................................................................................…
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…
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]
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]
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…
Programming basics · 3 marks · official answer ready
7 The truth table for a logic circuit is shown. INPUT OUTPUT A B C D T 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 1 0 …
Programming basics · 2 marks · official answer ready
(c) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products. [2]
Programming basics · 2 marks · official answer ready
(c) Draw loop(s) around appropriate group(s) in the K‑map to produce an optimal sum‑of‑products. [2]
Programming basics · 3 marks · official answer ready
7 The truth table for a logic circuit is shown. INPUT OUTPUT A B C D T 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 1 0 …
Programming basics · 2 marks · official answer ready
(c) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products. [2]
Programming basics · 7 marks
3 0.8 2 0.9 1 1.0 For example: • The horse Jet has PercentageSuccess of 65 and MaxFenceHeight of 160. • A fence has a height of 140 and a risk of 3. • The height of the fence is l…
Programming basics · 2 marks · official answer ready
(ii) Test your program with the following inputs in the order given: Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 2(e)(ii) in the ev…
