Programming
471 questions. Open a question to solve it and check the official answer.
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…
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 …
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. .......................................…
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…
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…
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]
Programming basics · 2 marks · official answer ready
(iv) Write the simplified sum-of-products expression for your answer to part (a)(iii). X = ........................................................................................…
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]
Programming basics · 2 marks · official answer ready
(iii) Write the simplified sum-of-products expression for your answer to part (b)(ii). X = ........................................................................................…
Programming basics · 1 mark · official answer ready
(i) xy = xy ^ c4 Reason .............................................................................................................................. ............................…
Programming basics · 1 mark · official answer ready
(ii) zy = zy \ 10 Reason .............................................................................................................................. ...........................…
Programming basics · 1 mark · official answer ready
(iii) yy := xz ^ − 6 Reason .............................................................................................................................. ........................…
Programming basics · 4 marks · official answer ready
(b) Complete the Backus-Naur Form (BNF) for the syntax diagrams on the opposite page. ::= .........................................................................................…
Programming basics · 2 marks · official answer ready
(c) Rewrite the BNF rule for a variable so that it can be any number of letters. ::= ..............................................................................................…
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 …
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…
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…
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…
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…
Programming basics · 1 mark · official answer ready
(i) A = B + 5; Reason .............................................................................................................................. ..............................…
