Programming
96 questions. Open a question to solve it and check the official answer.
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 ..............................................................................................…
Constructs · 0 marks
4 The standard pack of playing cards has four suits – called Clubs, Diamonds, Hearts and Spades. Each card has a value shown by its number or a name: 1 (Ace), 2, 3, … 10, 11 (Jack…
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…
