Question 5

OCR Computer Science June 2017 Paper 1A level12 marks

On the specification

(a)(i)
1.2 Software and software development
(a)(ii)
1.2 Software and software development
(b)(i)
1.2 Software and software development
(b)(ii)
1.2 Software and software development
(b)(iii)
1.2 Software and software development
(b)(iv)
1.2 Software and software development
(b)(v)
1.2 Software and software development
Question text

5 (a) Below is part of a program written using the Little Man Computer instruction set. This section of code can exit by either jumping to the code labelled pass or fail depending on what value is in the accumulator when the code is run. test SUB ten BRZ pass BRP test BRA fail ten DAT 10 (i) Explain what the line ten DAT 10 does. [3] (ii) Complete the table below determining whether the program branches to pass or fail given the following values in the Accumulator when it is run. Starting value in Accumulator pass or fail 29 30 31 [3] (b) The complete program is shown below: INP main STA entry BRA test fail LDA entry ADD one BRA main test SUB ten BRZ pass BRP test BRA fail pass LDA entry OUT HLT entry DAT ten DAT 10 one DAT 1 (i) Give one instruction in the program that when executed, changes the value in the Accumulator. [1] (ii) Give one instruction in the program that when executed, changes the value in the Program Counter. [1] (iii) State the value the code outputs for the input 18. [1] (iv) State the value the code outputs for the input 37. [1] (v) Describe the purpose of the program. [2]