Programming
258 questions. Open a question to solve it and check the official answer.
Constructs · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 3(d)(ii) in the evidence document. [1] 11 12 Permission to repr…
Constructs · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 3(e)(ii) in the evidence document. [1] Permission to reproduce …
Structured programming · 3 marks · official answer ready
(i) The procedure PrintArray() takes an integer array as a parameter and outputs the contents of the array in the order they are stored. The items are printed on the same line, fo…
Structured programming · 1 mark · official answer ready
(ii) Amend the main program to output the contents of DataArray using the procedure PrintArray() Save your program. Copy and paste the program code into part 1(b)(ii) in the evide…
Programming basics · 4 marks · official answer ready
(i) Amend the main program to: • prompt the user to input a whole number between 0 and 100 inclusive • read and validate the input from the user • call LinearSearch() with DataArr…
Constructs · 4 marks · official answer ready
(ii) The Helicopter method IncreaseSpeed() overrides the method from the parent class and: • adds the amount of vertical change to the vertical position • adds IncreaseAmount to t…
Constructs · 3 marks · official answer ready
(c) A procedure needs to output the horizontal position and speed of a vehicle. If the vehicle is a helicopter, it also outputs the vertical position. All outputs must include app…
Structured programming · 3 marks · official answer ready
(ii) Study the pseudocode function PopAnimal(): FUNCTION PopAnimal() RETURNS STRING DECLARE ReturnData : STRING IF AnimalTopPointer = 0 THEN RETURN "" ELSE ReturnData Animal[Anima…
Constructs · 5 marks · official answer ready
(iii) The procedure ReadData(): • reads the animal names from the file AnimalData.txt • uses PushAnimal() to insert each name onto the stack • uses appropriate exception handling …
Constructs · 5 marks · official answer ready
(c) The procedure OutputItem(): • pops the next item from both Animal and Colour • outputs the colour and animal on one line, for example "black horse" If there is no data in Colo…
Constructs · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 3(d)(ii) in the evidence document. [1] 11 12 Permission to repr…
Programming basics · 3 marks · official answer ready
10 (a) Explain the importance of feedback in a control system. ....................................................................................................................…
Constructs · 2 marks · official answer ready
(i) Identify one sensor that could be used in a car alarm system. Justify your choice. Sensor .....................................................................................…
Constructs · 3 marks · official answer ready
(ii) The car alarm is an example of an embedded system. Describe the characteristics of an embedded system. .......................................................................…
Programming basics · 2 marks · official answer ready
(ii) The following pseudocode statement includes array references: OUTPUT "Student ", Name[Count], " scored ", Mark[Count] State the purpose of the variable Count and give its dat…
Constructs · 4 marks · official answer ready
(c) The pseudocode statements in the following table may contain errors. State the error in each case or write ‘NO ERROR’ if the statement contains no error. Assume that any varia…
Constructs · 2 marks · official answer ready
(b) CountErrors() is called to check the project file Jim01Prog.txt and to stop if more than 20 errors are found. Write the pseudocode statement for this call. ...................…
Constructs · 2 marks · official answer ready
(d) Module CheckLine() includes a check for syntax errors. Two examples of syntax error that cannot be detected from examining a single line are those involving selection and iter…
Programming basics · 4 marks · official answer ready
(b) Examine the following state-transition diagram. Input-A Output-X Input-B Output-W Input-B START S1 S2 S3 Input-A Input-A Input-B S4 Input-A Output-W Complete the table to show…
Constructs · 5 marks · official answer ready
(c) A second stack is used in the program. The diagram below shows the initial state of this stack. Value X is at the top of the stack and was the last item added. Upper-case lett…
