Programming
471 questions. Open a question to solve it and check the official answer.
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…
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…
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…
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…
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…
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.…
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…
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…
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 …
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…
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…
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…
Programming basics · 1 mark · official answer ready
(b) Give one advantage of your solution. ..........................................................................................................................................…
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…
Constructs · 9 marks · official answer ready
(b) Write pseudocode for the module ProcessArray(). ...............................................................................................................................…
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]
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…
Constructs · 3 marks · official answer ready
(c) Give one example of a monitoring system. Explain why this is a monitoring system. Monitoring system ...........................................................................…
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]
Programming basics · 2 marks
(iii) Write the simplified sum-of-products Boolean expression for the truth table. X = ............................................................................................…
