[TURN OVER]
, Jan/Feb 2023
70 Marks
This paper consists of 8 pages out of 70 marks
INSTRUCTIONS:
1. Answer all the questions on a Word document/by hand
and convert to PDF.
2. Number your answers and label your rough work
clearly.
4. Marks are awarded for part of an answer, so do whatever
you are able to in each question.
[TURN OVER]
, ALL THE BEST
Downloaded by Vincent kyalo
()
[TURN OVER]
, lOMoAR cPSD| 48680473
2
Choose the correct option and write only the number
Question 1
[20]
1.What is the output of the following code fragment?
(2)
int x = 0; while( x < 8) cout << x << " "; x ++;
cout << x << endl;
1. 0
2. infinite loop
3. 1 2 3 4 5 6 7 8
4. 0 1 2 3 4 5 6 7 8
2.What is the value of x a fter the following statements?
(2)
int x, y, z; y = 10;
z = 3; x = y * z -
3;
1. 0
2. 3
3. 10
4. 27
3.What is the value of x a fter the following statements?
(2)
Downloaded by Vincent kyalo ()
, Jan/Feb 2023
70 Marks
This paper consists of 8 pages out of 70 marks
INSTRUCTIONS:
1. Answer all the questions on a Word document/by hand
and convert to PDF.
2. Number your answers and label your rough work
clearly.
4. Marks are awarded for part of an answer, so do whatever
you are able to in each question.
[TURN OVER]
, ALL THE BEST
Downloaded by Vincent kyalo
()
[TURN OVER]
, lOMoAR cPSD| 48680473
2
Choose the correct option and write only the number
Question 1
[20]
1.What is the output of the following code fragment?
(2)
int x = 0; while( x < 8) cout << x << " "; x ++;
cout << x << endl;
1. 0
2. infinite loop
3. 1 2 3 4 5 6 7 8
4. 0 1 2 3 4 5 6 7 8
2.What is the value of x a fter the following statements?
(2)
int x, y, z; y = 10;
z = 3; x = y * z -
3;
1. 0
2. 3
3. 10
4. 27
3.What is the value of x a fter the following statements?
(2)
Downloaded by Vincent kyalo ()