Computer Science 9608 · 11

Programming

471 questions. Open a question to solve it and check the official answer.

2015 October-November · Paper 22 · Q4(b)(i)

Constructs · 1 mark · official answer ready

(i) A statement which marks the end of a count controlled loop. ...................................................................................................................…

2015 October-November · Paper 22 · Q4(b)(ii)

Constructs · 1 mark · official answer ready

(ii) The declaration of a local variable. .......................................................................................................................................[1]

2015 October-November · Paper 22 · Q4(b)(iv)

Constructs · 1 mark · official answer ready

(iv) A statement which uses a built-in function of the programming language. ......................................................................................................…

2015 October-November · Paper 22 · Q5(a)(i)

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

2015 October-November · Paper 22 · Q5(a)(ii)

Constructs · 1 mark · official answer ready

(ii) State the purpose of the algorithm. ..........................................................................................................................................…

2015 October-November · Paper 22 · Q5(a)(iii)

Constructs · 1 mark · official answer ready

(iii) Describe what evidence from the trace table suggests that the given pseudocode is inefficient. ..............................................................................…

2015 October-November · Paper 22 · Q5(b)

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

2015 October-November · Paper 22 · Q6(b)(ii)

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…

2015 October-November · Paper 22 · Q7(b)(i)

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…

2015 October-November · Paper 23 · Q5(b)

Constructs · 6 marks · official answer ready

(b) Complete the pseudocode for this design. OUTPUT "Enter purchase price" INPUT PurchasePrice CurrentValue ← .....................................................................…

2015 October-November · Paper 23 · Q6(c)(ii)

Constructs · 1 mark · official answer ready

(ii) Copy the condition which is used to control a ‘pre-condition’ loop. ..........................................................................................................…

2015 October-November · Paper 23 · Q6(d)

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…

2015 October-November · Paper 23 · Q8(d)(ii)

Constructs · 3 marks · official answer ready

(ii) Describe three specification changes which will make the program more useful. 1 ..............................................................................................…

2015 October-November · Paper 31 · Q2(a)

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

2015 October-November · Paper 31 · Q5(a)(i)

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…

2015 October-November · Paper 31 · Q5(b)(i)

Programming basics · 4 marks · official answer ready

(i) Complete the K-map corresponding to the truth table above. AB CD [4]

2015 October-November · Paper 31 · Q5(b)(ii)

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]

2015 October-November · Paper 31 · Q5(b)(iii)

Programming basics · 2 marks · official answer ready

(iii) Using your answer to part (b)(ii), write the simplified sum-of-products Boolean function. X = ...............................................................................…

2015 October-November · Paper 31 · Q6(d)

Constructs · 2 marks · official answer ready

(d) Explain the role of the high-level scheduler in a multiprogramming operating system. ..........................................................................................…

2015 October-November · Paper 32 · Q2(a)

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