Computer Science 9608 · 11

Programming

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

Reset
2019 May-June · Paper 21 · Q2(c)

Constructs · 3 marks · official answer ready

(c) The following lines of code are taken from a program in a high-level language. ON x { 15: Call ProcA 20: y := 0 25: y := 99 NONE: Call ProcError } Identify the type of control…

2019 May-June · Paper 21 · Q3(a)

Constructs · 7 marks · official answer ready

3 (a) A student is developing an algorithm to search through a 1D array of 100 elements. Each element of the array, Result, contains a REAL value. The algorithm will output: • the…

2019 May-June · Paper 21 · Q5(b)

Structured programming · 8 marks · official answer ready

(b) A student is learning about random number generation. She is investigating how many times the random function needs to be called before every number in a given series is gener…

2019 May-June · Paper 22 · Q1(b)(i)

Constructs · 5 marks · official answer ready

(i) Evaluate each expression in the following table. If an expression is invalid, write ERROR. For the built-in functions list, refer to the Appendix on page 16. Expression Evalua…

2019 May-June · Paper 22 · Q1(b)(ii)

Programming · 5 marks · official answer ready

(ii) Programming languages support different data types. Give an appropriate data type for the following variables from part (b). Variable Data type Married ID MiddleInitial Heigh…

2019 May-June · Paper 22 · Q2(a)(iii)

Structured programming · 2 marks · official answer ready

(iii) The following pseudocode uses the subroutine DoSomething(). Answer 23 + DoSomething("Yellow") State whether the subroutine is a function or a procedure. Justify your answer.…

2019 May-June · Paper 22 · Q2(c)

Constructs · 3 marks · official answer ready

(c) The following lines of code are taken from a high-level language program. WHEN Result < 20 { Call ResetSensor(3) Result := GetSensor(3) } Identify the type of control structur…

2019 May-June · Paper 22 · Q5(b)

Structured programming · 6 marks · official answer ready

(b) A procedure, CountLines(), is being written to count the number of lines in a text file. The procedure will: • take a filename as a string parameter • count the number of line…

2019 May-June · Paper 22 · Q6(a)

Constructs · 8 marks · official answer ready

(a) Write program code for the module GetInfo(). Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement …

2019 May-June · Paper 22 · Q6(b)

Constructs · 8 marks · official answer ready

(b) Write program code for the module TopLevel(). Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement…

2019 May-June · Paper 23 · Q1(b)(i)

Constructs · 6 marks · official answer ready

(i) Program variables have values as follows: Variable Value MeltingPoint 180.5 Soluble FALSE Attempt 3 ProductName "Mushroom Compost" Version 'A' ProductID "BZ27-4" Evaluate each…

2019 May-June · Paper 23 · Q1(b)(ii)

Programming · 6 marks · official answer ready

(ii) Programming languages support different data types. Give an appropriate data type for the following variables from part (b)(i). Variable Data type MeltingPoint Soluble Attemp…

2019 May-June · Paper 23 · Q4(b)

Programming basics · 1 mark · official answer ready

(b) Give one advantage of your solution. ..........................................................................................................................................…

2019 May-June · Paper 23 · Q6(a)

Constructs · 8 marks · official answer ready

(a) Write program code for the module SearchFile(). Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment stateme…

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

Constructs · 9 marks · official answer ready

(b) Write pseudocode for the module ProcessArray(). ...............................................................................................................................…

2019 May-June · Paper 31 · Q4(a)

Programming basics · 3 marks · official answer ready

(a) Complete the symbol table to show its contents after the lexical analysis stage. Token Symbol Value Type Counter 60 Variable [3]

2019 May-June · Paper 31 · Q4(b)

Constructs · 2 marks · official answer ready

(b) The output from the lexical analysis stage is stored in the following table. Each cell stores one byte of the output. Complete the output from the lexical analysis using the k…

2019 May-June · Paper 31 · Q6(c)

Constructs · 3 marks · official answer ready

(c) Give one example of a monitoring system. Explain why this is a monitoring system. Monitoring system ...........................................................................…

2019 May-June · Paper 32 · Q3(a)(ii)

Programming basics · 2 marks · official answer ready

(ii) Draw loops around appropriate groups of 1s in the K-map to produce an optimal sum-of- products. [2]

2019 May-June · Paper 32 · Q3(a)(iii)

Programming basics · 2 marks

(iii) Write the simplified sum-of-products Boolean expression for the truth table. X = ............................................................................................…