Question 4

OCR Computer Science Specimen Paper 2AS17 marks

On the specification

(a)
2.2 Problem solving and programming
(b)
2.2 Problem solving and programming
(c)(i)
2.2 Problem solving and programming
(c)(ii)
2.2 Problem solving and programming
(d)
2.2 Problem solving and programming1.2 Software and software development
Question text

4 Nobugs is a software development company that produces enterprise-wide management software for large companies. Its software products are built up from many program functions. The managers of Nobugs enforce standard rules on their programmers about how program functions should be written. The following are some of the rules that they insist upon:  no function may be longer than a single page of code  variable identifiers must conform to a standard convention  each function must have a single entry point  variables must not be set up outside the scope of a function  hardware-specific code must be avoided  embedded documentation must be adequate. (a) Describe what is meant by a function. [2] (b) Compare a program procedure with a function. [2] (c) A programmer at Nobugs has written some program code that includes two user defined functions. function my_function1(number) return number*number*number endfunction function my_function2(number) return number*number*number*number endfunction number=int(input("Enter a number ")) print(my_function1(number)) print(my_function2(number)) (i) Apart from the two functions written by the programmer, identify two other functions used in this piece of program code. 1 2 [2] (ii)The programmer tests this code with the input value of 3. State the output that would be obtained. [2] (d)* Nobugs enforces standard rules about writing functions on its programmers. Discuss the reasons why this might be the case. [9]