Computer Science 9608 · 11

Programming

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

2018 May-June · Paper 23 · Q2(b)

Constructs · 9 marks · official answer ready

(b) Study the function GradeCalc(). Identify the features of the function in the following table. Feature Answer A line number containing an example of an integer assignment state…

2018 May-June · Paper 23 · Q2(c)(i)

Constructs · 2 marks · official answer ready

(i) There is a mistake in the pseudocode that would produce a data type mismatch error if a programmer were to write similar program code. Describe this mistake and how it may be …

2018 May-June · Paper 23 · Q2(c)(ii)

Constructs · 4 marks · official answer ready

(ii) Lines 14 to 30 of the pseudocode on page 4 could be written using a CASE structure. Write the equivalent CASE structure in pseudocode. .......................................…

2018 May-June · Paper 23 · Q5(c)

Constructs · 10 marks · official answer ready

(c) The strings are stored in a text file, ScoreDetails.txt. The program needs a function, GetAverageScore(). The structured English representing the algorithm for this function i…

2018 May-June · Paper 23 · Q6(b)

Structured programming · 9 marks · official answer ready

(b) A 2D array, Picture, contains data representing a bitmap image. Each element of the array represents one pixel of the image. The image is grey-scale encoded where the value of…

2018 May-June · Paper 31 · Q4(a)(iii)

Programming basics · 2 marks · official answer ready

(iii) Draw loop(s) around appropriate group(s) of 1s to produce an optimal sum-of-products for the table in part (a)(ii). [2]

2018 May-June · Paper 31 · Q4(a)(iv)

Programming basics · 2 marks · official answer ready

(iv) Write the simplified sum-of-products expression for your answer to part (a)(iii). X = ........................................................................................…

2018 May-June · Paper 31 · Q4(b)(ii)

Programming basics · 2 marks · official answer ready

(ii) Draw loop(s) around appropriate group(s) of 1s to produce an optimal sum-of-products for the table in part (b)(i). [2]

2018 May-June · Paper 31 · Q4(b)(iii)

Programming basics · 2 marks · official answer ready

(iii) Write the simplified sum-of-products expression for your answer to part (b)(ii). X = ........................................................................................…

2018 May-June · Paper 31 · Q5(a)(i)

Programming basics · 1 mark · official answer ready

(i) xy = xy ^ c4 Reason .............................................................................................................................. ............................…

2018 May-June · Paper 31 · Q5(a)(ii)

Programming basics · 1 mark · official answer ready

(ii) zy = zy \ 10 Reason .............................................................................................................................. ...........................…

2018 May-June · Paper 31 · Q5(a)(iii)

Programming basics · 1 mark · official answer ready

(iii) yy := xz ^ − 6 Reason .............................................................................................................................. ........................…

2018 May-June · Paper 31 · Q5(b)

Programming basics · 4 marks · official answer ready

(b) Complete the Backus-Naur Form (BNF) for the syntax diagrams on the opposite page. ::= .........................................................................................…

2018 May-June · Paper 31 · Q5(c)

Programming basics · 2 marks · official answer ready

(c) Rewrite the BNF rule for a variable so that it can be any number of letters. ::= ..............................................................................................…

2018 May-June · Paper 31 · Q7(a)(iii)

Programming basics · 4 marks

7 …………… [3] (a) A Boolean expression produces the following truth table. INPUT OUTPUT A B C X 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 (iii) yy := xz ^ − 6 …

2018 May-June · Paper 31 · Q7(a)(iv)

Programming basics · 5 marks

7 …………… [3] (a) A Boolean expression produces the following truth table. INPUT OUTPUT A B C X 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 (iv) Write the simpli…

2018 May-June · Paper 31 · Q7(b)(i)

Programming basics · 7 marks

7 …………… [3] (b) A logic circuit with four inputs produces the following truth table. INPUT OUTPUT A B C D X 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0…

2018 May-June · Paper 31 · Q7(b)(ii)

Programming basics · 5 marks

7 …………… [3] (b) A logic circuit with four inputs produces the following truth table. INPUT OUTPUT A B C D X 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0…

2018 May-June · Paper 31 · Q7(b)(iii)

Programming basics · 5 marks

7 …………… [3] (b) A logic circuit with four inputs produces the following truth table. INPUT OUTPUT A B C D X 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0…

2018 May-June · Paper 32 · Q2(a)(i)

Programming basics · 1 mark · official answer ready

(i) A = B + 5; Reason .............................................................................................................................. ..............................…