Quelpr

CSEC Information Technology · May/June 2013 · Paper 2 · Question 10(a)(iv)

Consider the provided Pascal program: 1 Program lesser; 2 Var X, Y: integer; 3 4 Begin 5 6 readln(X, Y); 7 If X < Y 8 Then Writeln ('X is the smaller number') 9 Else Writeln ('Y is the smaller number'); 10 End.

State the line number in which the error exists and rewrite the program code that would correct the error.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 10(a)(i)State the output from the program when 4 is input for both X and Y.[2 marks]
  2. 10(a)(ii)State the line number that produced the output statement in (a)(i) above.[1 mark]
  3. 10(a)(iii)The output suggests an error exists. State the name of the type of error.[1 mark]
  4. 10(a)(v)State the type of structure that is used in lines 7 to 9.[1 mark]
  5. 10(b)(i)Write a statement to initialize the variable X to zero.[2 marks]
  6. 10(b)(ii)State the line number in which the statement in (b)(i) above could be appropriately inserted.[1 mark]

More practice: the rest of this paper · more Program Checks and Tests questions · all CSEC Information Technology past papers