Computer Science For First Examination In 2021 9618 · 11

11.1 Programming basics

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

Reset
2025 October-November · Paper 21 · Q7(a)

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…

2025 October-November · Paper 23 · Q7(a)

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…

2025 October-November · Paper 32 · Q12(a)(ii)

Programming basics · 2 marks · official answer ready

(ii) Write pseudocode to input a new data item and add it to the stack using Push(). ..............................................................................................…

2025 October-November · Paper 43 · Q9(a)

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 …

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

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…

2025 October-November · Paper 43 · Q9(c)

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…

2025 October-November · Paper 43 · Q9(d)

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…

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

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…

2025 May-June · Paper 31 · Q5(a)

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 = ......................................................................…

2025 May-June · Paper 31 · Q5(b)(ii)

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]

2025 May-June · Paper 33 · Q3(a)

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 = ......................................................................…

2025 May-June · Paper 33 · Q3(b)(ii)

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]

2025 May-June · Paper 41 · Q2(e)(ii)

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…

2024 October-November · Paper 31 · Q7(a)

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 …

2024 October-November · Paper 31 · Q7(c)

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]

2024 October-November · Paper 32 · Q6(c)

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]

2024 October-November · Paper 33 · Q7(a)

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 …

2024 October-November · Paper 33 · Q7(c)

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]

2024 October-November · Paper 41 · Q3(e)(iii)

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…

2024 October-November · Paper 42 · Q2(e)(ii)

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…