Programming
471 questions. Open a question to solve it and check the official answer.
Constructs · 1 mark · official answer ready
(i) A statement which marks the end of a count controlled loop. ...................................................................................................................…
Constructs · 1 mark · official answer ready
(ii) The declaration of a local variable. .......................................................................................................................................[1]
Constructs · 1 mark · official answer ready
(iv) A statement which uses a built-in function of the programming language. ......................................................................................................…
Constructs · 8 marks · official answer ready
(i) Trace the execution of the pseudocode for the value N = 5 and the given array of integers. Num N i j Temp 1 2 3 4 5 5 11 16 13 7 8 [8] 12
Constructs · 1 mark · official answer ready
(ii) State the purpose of the algorithm. ..........................................................................................................................................…
Constructs · 1 mark · official answer ready
(iii) Describe what evidence from the trace table suggests that the given pseudocode is inefficient. ..............................................................................…
Constructs · 5 marks · official answer ready
(b) Complete the identifier table documenting the use of each of the variables. Identifier Data type Description Num ARRAY[1:100] OF INTEGER The array of numbers. N i j Temp [5] 13
Programming basics · 7 marks · official answer ready
(ii) An experienced programmer suggests this pseudocode would be best designed as a function. Complete the re-design of the pseudocode as follows: The main program: • the user ent…
Programming basics · 8 marks · official answer ready
(i) Write the above pseudocode algorithm as program code. Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment s…
Constructs · 6 marks · official answer ready
(b) Complete the pseudocode for this design. OUTPUT "Enter purchase price" INPUT PurchasePrice CurrentValue ← .....................................................................…
Constructs · 1 mark · official answer ready
(ii) Copy the condition which is used to control a ‘pre-condition’ loop. ..........................................................................................................…
Constructs · 4 marks · official answer ready
(d) Line 17 in the pseudocode outputs the staff number and the task number. Staff number Staff name A new requirement is to display the name of the member of staff given in the ta…
Constructs · 3 marks · official answer ready
(ii) Describe three specification changes which will make the program more useful. 1 ..............................................................................................…
Programming basics · 3 marks · official answer ready
(a) Complete the symbol table below to show its contents after the lexical analysis stage. Token Symbol Value Type Counter 60 Variable 1.5 61 Constant [3] 5
Programming basics · 3 marks · official answer ready
(i) Complete the Boolean function that corresponds to the following truth table. INPUT OUTPUT A B C X 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 X = A . B . C…
Programming basics · 4 marks · official answer ready
(i) Complete the K-map corresponding to the truth table above. AB CD [4]
Programming basics · 2 marks · official answer ready
(ii) Draw loop(s) around appropriate groups of 1’s to produce an optimal sum-of-products. [2]
Programming basics · 2 marks · official answer ready
(iii) Using your answer to part (b)(ii), write the simplified sum-of-products Boolean function. X = ...............................................................................…
Constructs · 2 marks · official answer ready
(d) Explain the role of the high-level scheduler in a multiprogramming operating system. ..........................................................................................…
Programming basics · 3 marks · official answer ready
(a) Complete the symbol table below to show its contents after the lexical analysis stage. Token Symbol Value Type Start 60 Variable 0.1 61 Constant [3] 5
