Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Object Oriented Programming 1 Question Paper

Object Oriented Programming 1 

Course:Bachelor Of Science In Information Technology

Institution: Kca University question papers

Exam Year:2010



1
UNIVERSITY EXAMINATIONS: 2010/2011
FIRST YEAR STAGE EXAMINATION FOR THE DEGREE OF BACHELOR
OF SCIENCE IN INFORMATION TECHNOLOGY
BIT 2108: OBJECT ORIENTED PROGRAMMING I
DATE: DECEMBER 2010 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE
a) With help of a sample program describe the structure of C++ program. Explain also the concept of
client-server model as applied in design of a C++ program. (8 Marks)
b) Explain the concept of object technology as used in application development. (4 Marks)
c) Differentiate between enum and union Abstract Data Types as used in C++ Language. Give
examples to support your argument. (4 Marks)
d) Explain the concept of software crisis (4 Marks)
e) Explain at least five features in any object oriented programming language that support object
technology (10 Marks)
QUESTION TWO
a) Predict the output of the following program
b) Describe the following terms as used in OOP
i). Static memory allocation
ii). Dynamic memory allocation
iii).Constructors
iv). Destructors (8 Marks)
c) Write a program that displays an invoice of several items. It should contain the item name,
quantity, price, and total cost on each line for the quantity and item cost. It also contains methods to
get and set item name, quantity, and price. Objects are created in main and invoices printed.
(8 Marks)
QUESTION THREE
a) Write a program that calculates and displays the weekly salary for an employee who earns $25 an
hour, works 40 regular hours, 13 overtime hours, and earns time and one-half (wage * 1.5) for
overtime hours worked. Create a separate method to do the calculation and return the result to be
3
displayed. Your program contain a class that holds the employee details indicated as well as the
method to do the computation (8 Marks)
b) Define the following
i. Method
ii. Inheritance
iii.Class (6 Marks)
c) Create a class named Box that includes integer data fields for length, width, and height. Create
three constructors that require one, two, and three arguments, respectively. When one argument is
used, assign it to length, assign zeros to height and width, and print “Line created”. When two
arguments are used, assign them to length and width, assign zero to height, and print “Rectangle
created”. When three arguments are used, assign them to the three variables and print “Box
created”. (6 Marks)
QUESTION ONE
a) Debug the following program.
b) Find the errors in the following function prototype.
i). Float average(a,b);
ii). Int mul(int a,b);
iii).Int display();
iv). Void vect(int&v,int&size);
v). Void print(float data[],size=20);
(5 Marks)
c) State with a reason whether the following statements are true or false.
(i) Function argument is a value returned by the function to the calling program.
(ii) When a function returns a value, the entire function can be assigned to variable.
(iii) When argument is passed by value the function works with the original arguments in
the calling program.
(iv) A function can return a value by reference.
(v) When argument is passed by reference, a temporary variable is created in the calling
program to hold the argument value. (5 Marks)
d) Briefly discuss how each of the following visibility modifiers affects inheritance of member
elements in derived classes.
(i) Private (2 Marks)
(ii) Public (1 Mark)
(iii) Protected (2 Marks)
QUESTION FIVE
(a) With a valid example, explain how ADT are created. (3 Marks)
(b) Describe how abstraction is achieved when using class object to implement systems. (3 Marks)
(c) Describe code reuse as used in application development. (2 Marks)
(d) Differentiate between multiple and hierarchical inheritance. (2 Marks)
(e) Explain how classes achieve code hiding and code reuse in a program. Write a program to help
explain your answer. (10 Marks)






More Question Papers


Popular Exams



Return to Question Papers