Question 6
OCR Computer Science June 2016 Paper 2AS13 marks
On the specification
- (a)
- 2.2 Problem solving and programming
- (b)
- 2.2 Problem solving and programming
- (c)
- 2.1 Elements of computational thinking2.2 Problem solving and programming
Question text
6 (a) A programmer is going to design a procedure that will prompt for and receive two values, A and B. The procedure will then compare them. The procedure will also write a suitable message to a file on disk depending on whether: • the values are the same • A is less than B, or • B is less than A. Use pseudocode to write the procedure. [5] (b) The code below uses a procedure: name = "Sam" addMessage(name) print(name) procedure addMessage(inText:byVal) inText = "Hello " + inText endprocedure Explain why this program outputs Sam rather than Hello Sam. [2] (c) Explain the advantages of writing an application using a modular approach. [6]