REPUBLIC OF RWANDA
MUHANGA DISTRICT
ACADEM YEAR: 2016
2nd TERM
DISTRICT TEST OF PROGRAMMING
OPTION: COMPUTER SCIENCES
LEVEL: S5 CSC
DURATION: 3 HOURS
INSTRUCTIONS:
THIS PAPER CONTAINS THREE (3) SECTIONS.
SECTION A: ALL QUESTIONS ARE COMPULSORY.
SECTION B: FIVE QUESTIONS; CHOOSE ANY THREE (3).
SECTION C: THREE QUESTIONS; CHOOSE ANY ONE (1).
NB: PLEASE ORDER THE QUESTIONS.
1. C++ Developed from c. who and where C++ created? /4marks
2. What do you mean by Loops? /3marks
3. How many times will the following loops be executed? /10marks
a. For(a=0; a<14;a++)
{
Statement 1;
}
b. For(a=0; a>=14; a++)
{
Statement 1;
}
c. I=10;
While(I<=50)
{
Statement 1;
I++;
}
d. For(a=35; a<=20; a++)
{
Statement 1;
}
e. i=0;
do
{
Statement 1;
i++;
}
While(i<0);
Page | 1
4. Differentiate while statement to do…. While statement. /4marks
5. What is the difference between ++a and a++ in programming.
/5marks
6. Differentiate the 2 types of variables? /6marks
7. C++ was initially called “C with classes”.
a. What is a class? /3marks
b. Differentiate class with structure in C++. /4marks
c. Give syntax (example) of how to declare a structure or a class by
your choice. /3marks
8. Inheritance is one of the fundamental features of the OOPs. Define
inheritance and give the types of inheritance? /6marks
9. What is the use of break statement in control structure: switch case?
/2marks
10. Write a c++ program that displays your name 10 times using
while loop. /5marks
SECTION B
11. Explain the Characteristics of C++. /10 marks
12. Write a program that generates any multiplication table of a
number entered by user. /10 marks
13. Write a C++ program to print the sum of the ten first numbers
using loop. / 10 marks
14. Write a program that asks the user to type 10 integers and
writes the sum of these integers. /10 marks
15. Write a C++ program to determine a number entered by a user
from the keyboard if is odd or even. /10 marks
Page | 2
SECTION C
16. Write a program that asks the user to type an integer N between
0 and 20 (both included) and writes N+17. If someone types a wrong
value, the program writes ERROR and he must type another value until
the number in the range is found. /15marks
17. a. What does this circuit compute as R1? /5 marks
b. complete the table below: /10 marks
Operator The name of operator
+
-
/
*
<
>
<=
>=
==
!=
Page | 3