0% found this document useful (0 votes)
39 views2 pages

Instructions: Question One TWO

The document outlines the examination details for a course in Object Oriented Programming, including instructions and questions for students. It consists of four main questions covering various topics such as programming concepts, class implementation, function characteristics, and polymorphism. Students are required to answer question one and any two additional questions within a two-hour timeframe.

Uploaded by

2401457
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Instructions: Question One TWO

The document outlines the examination details for a course in Object Oriented Programming, including instructions and questions for students. It consists of four main questions covering various topics such as programming concepts, class implementation, function characteristics, and polymorphism. Students are required to answer question one and any two additional questions within a two-hour timeframe.

Uploaded by

2401457
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIVERSITY EXAMINATIONS: 2023/2024

EXAMINATION FOR DEGREE IN BACHELOR OF SCIENCE


SOFTWARE DEVELOPMENT/APPLIED COMPUTING/INFORMATION
SECURITY AND FORENSIC.
BAC 2101/ BSD 2102/BISF 2101: OBJECT ORIENTED PROGRAMMING
FULL TIME/PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: AUGUST 2024 TIME: 2 HOURS

INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO.

QUESTION ONE [20 Marks]


a) Outline three typical steps in developing an object oriented program. 3 Marks
b) Explain the circumstance under which the following data types are most applicable in OOP.
i) Struct
ii) Class
iii) Union. 6 Marks
c) Explain the terms state and behavior as used in object oriented programming. 2 Marks
d) Copy and complete the table below to show the visibility of inherited members:
Parent class Child class visibility
visibility
Protected Public Private
derivation derivation derivation
Public
Private
Protected

9 Marks
QUESTION TWO [15 Marks]
a) Write a C++ program that will implement a class named E-Shamba containing two variables and
two constructors(unparameterized and parameterized). The constructors are used to initialize two
objects S1(13,19) and S2(25,35) respectively. In addition, the class contains a method named Area
used to determine the area of the objects. 8 Marks
b) Assuming you are required to create traffic alert system for road users in Kenya using OOP.
Suggest two possible classes. For each class, suggest two data members and methods that you will
use justifying your answer. 7 Marks

QUESTION THREE [15 Marks]


a) Explain the differences between function signature and function prototype. 4 Marks
b) Outline THREE characteristics of a friend function in C++. 3 Marks
c) You are required to develop a program that reads quantity and price data members of a class
named product then uses friend function to calculate the cost VAT inclusive( VAT is a constant
and is 16% on the price). 8 Marks

QUESTION FOUR [15 Marks]


a) Describe THREE benefits of polymorphism in object oriented program. 3 Marks
b) Using an example describe the use of a pure virtual function in C++. 5 Marks
c) Write a C++ program that uses overloaded function named compute to determine the area or
volume of rectangular objects based on the number of arguments provided. The program should
determine and output area or volume appropriately for O1(15,6) and O2(7,5,10). 7 Marks

You might also like