You are on page 1of 2

BBIT 214: 

     OBJECT ORIENTED PRORAMMING I

DATE: APRIL 2017                                                                                                   TIME: 2HOURS

Instructions: Attempt QUESTION ONE and ANY OTHER TWO questions

Question 1 (30 marks): Compulsory

• Explain the following features of object oriented programing languages. (6marks)


1. Encapsulation
2. Inheritance

• Polymorphism

1. Abstraction

• Why is C++ regarded as superset of C language? (2marks)


• Explain the following Object Oriented programming concepts.
1. Object (2marks)
2. Message Passing                                                            (2marks)

• Class (2marks)

1. Member function (2marks)

• State four advantages of object oriented languages over the other languages. (4marks)

(i) De�ne the term variables.                                                                          (2marks)

(ii) Stave four rules for naming variables in C++/ java.                                               (4marks)

(iii) Using example demonstrate how variables are declared and initialized in Java/C++.                              
                                                                                                                        (4marks)

Question 2 (20marks)

• De�ne the term array. (2marks)


• Explain three core features of arrays. (6marks)
• Using examples di�erentiate between one dimensional and two dimensional arrays. Show how each type is declared and
initialized in Java/C++.             (8marks)
• Write a program to declare and initialize two integer variables, compare them and print out the larger value on the screen
.                                                                       (4marks)

Question 3 (20marks)

• Rewrite the program given below using switch case selection control structure construct. (6marks)

char letter;

String country;

if(letter ==”A”)

country=”Algeria”;

else if(letter=”B”)

country=”Botswana”;

else if(letter=”G”)

country=”Gabon”;

else
cout<<“Sorry no match for your letter”;

• Write a program is required to calculate net pay for a casual worker. The user inputs the number of days worked and daily pay
using keyboard input. A tax of 16% is deducted from the payable amount. Write a complete program that computes the payable
amount, tax deducted and the net pay and display the results. De�ne functions to compute each of the results.                                   
                                   (8marks)

• Explain the di�erence between local and global variables as used in C++. Use example code.
                                                                                                                                    (6marks)

Question 4 (20marks)

• De�ne the term constructor. (2marks)


• Write a program to demonstrate how overloaded constructors are declared and used in OO programming.

(6marks)

• Design a class program for a The class consist the following member variables: Student ID, Student Names, Course and Semester fee.
The methods include: getStudentDetails (for initializing the student details) and displayStudentDetails (for printing the student details
on the screen). The class contains one object Mystudent.

(12marks)

Question 5 (20marks)

(a)    A program is required to compute grades for student performance in OOP. The user inputs the marks scored in the unit to get
the grade. The grading system is as follows:

Marks Grade

0      –  39 Fail

40     – <50 Pass

50     – < 60 Average

60     – < 70 Credit

70   –    100 Distinction

Any other input Invalid score

Using if statement implement the above program.                                                   (8marks)

(b) Give three characteristics of a good user interface.                        .                                   (3marks)

(c) Using examples codes, discuss three types of loops used in programming.                         (9marks)

You might also like