Question 8

OCR Computer Science June 2019 Paper 1A level10 marks

On the specification

(a)
2.2 Problem solving and programming
(b)
1.4 Data types, data structures and algorithms
(c)
1.4 Data types, data structures and algorithms
(d)
1.4 Data types, data structures and algorithms
(e)
2.2 Problem solving and programming
(f)
1.2 Software and software development
(g)
1.2 Software and software development
Question text

8 A simple program is shown below. //Program to calculate number of times //a number goes into 100 count = 0 num = int(input("Enter a number")) while (count*num)<=100 count=count+1 endwhile count=count-1 //Take one off as gone over print(str(num) + " goes into 100 " + str(count) + " times.") Fig. 8.1 (a) State the output of the program when the number 30 is entered. [1] (b) State the most suitable data type of the variable count [1] (c) State the data type of the result of the expression (count*num)<=100 [1] (d) State the data type of the result of the expression str(num) + " goes into 100 " + str(count) + " times." [1] (e) Write extra code so the program also displays the remainder. [2] The program is compiled. The first stage is Lexical Analysis. (f) Referring to examples in the code in Fig. 8.1, explain what happens in Lexical Analysis. [3] (g) State the name of the stage of compilation that directly follows Lexical Analysis. [1]