Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

d a qo n a s g o

Prorete

pae,
University of
Eldoret
aTe of knowiodge and nnovaton

UNIVERSITY EXAMINATIONS
pru

2020/2021 ACADEMIC YEAR


77
T d e
20

upnam

cobBE XEGULAR
FAICE
EXAMINATION
FOR THE DEGREE OF
NArMElE

Cna
BACHELOR OF SCIENCE
Ma )

V
URSE CODE:
OURSE
COMP 213

COURSE TITLE: OBJECT ORIENTED


PROGRAMMING

DATE: 21ST MAY, 2021 TIME: 8.00 AM -11.00 AM

INSTRUCTIONS TO CANDIDATES

SEE INSIDE

(4) PRINTED PAGES. PLEASE TURN OVER


THIS PAPER CONSISTS OF

is ISO 9001:2015 Certified KEBS


University of Eldoret
COMP 213: OBJECi ORIENTED PROGRAMMING, APRII 2021 MAIN EXAMINATIONS (COMP, ANC, AST, BT)

Instuetions: Answer All questions in section A and any other R E E n m sectton

PpOP wlk
natoo
Sction A (24 Marks) Compulsurb Pddpup
w r.
1knlan
l 7M o h 2 D s a u n d e r o u o

ution One (12 Marks) ncnahweioo

9 ty
3 N d
a. ProgrammeTS are migrating rom structured prðgramming to object oriented

programing. Explain the reasons for this shift 4 marks]


b. A conmpany that deals witlh the production of electrical equipments needs a software
uShoprogram to manage theirinventorypAs a programmeplain thecritei t h a M g ppof
Pothshw"
use to sclect the best software. Amane r a 1 [5 marks)
Write a class oriented program to display "welcometo object oriented programiming.

[3 marks]
Question Two (12 Marks)

a Explain the following types of variables ip a program marks] whui


dsand vok lyuoor ausfo. ofskmoaw up a

Aug riapes Yariaes


i. Glob varablesyans Kan
111.
e param. poat hS[vöue ZorD
b. Using a programming example, explain the concept of "array of objecis [6 marks]
Discuss the possible ways under which variables can be initialized in C++ program.

[3 marks]

Section B (36 Marks) attempt any three questions

Discuss the potential meanings of the throw, try, and catch in exception handling. Use

syntax to demonstrate the implementation. 14 marks]


K en hauie
detault constructors in a class.
b. With the help of syntax and an example, explain
[4 marks]

C. A class is required to determine the number of bytes for each data type entered into the
class oriented program that displays the corresponding bytes for
each
program. Write a

data type in the program. 14 marks)


A Size i

Saotohnr )
k k e r sA
ntze
Pnvee cou
Y D v d a h o o (
EXAMINATIONS (COMP, ANC, ASt, BIT)|
213: OBJECT ORIENTED PROGRAIMIMING, APRIL
2021i MAIN
UM

Question Four (12 Marks)


oriented
in object
EXplain the imporiance
of the following typcs of opcrators
[4 marks]
gulemofu Cf
programming. fpmqraMMu

Semi colon (:) Gm use

Raovhe wvsliaf
ons in
11. operesolution operator ( :: )
Tunoion Nümes in OoP
ii. Conditiona operators o n ePres s Mwduhu
to Galljunohon o
tvefuatty m
The dot operator. Se nen Memubu Junzh
OSe to a w es
of control structures.

b. With the of
help and a
syntaxflowchart, explain the following types
marks
break loop control structure
i.
3 marks
contiie loop control structure
11.
ternms
[2 marks]
c. Explain the following object oriented programming
. Friend functions
prbloms
is. Eapsulatign

doenPrim
prOiramMinO
uortd

reul

expaniO
Junpyn
ereuro
Question Ffve (12 Marks)

the program in terms of objects and


functions. [3 marks]
a. Discuss the benefits of dividing
in C++.
the concept of function overloading
b. Using a programing example, explain
3 marks]

of inheritance. Write a class oriented


discuss the different forms
C. With the help of syntax,
inheritance.
[6 marks]
demonstrate multilevel
program to

Question Six (12 Marks)


oriented program to
an algorithm. Write a class
number? Explain using
a. What is a strong [6 marks]
number.
entered number
is a strong
check if any
write a class oriented program
to compute the
a flowchart
With the help of syntax and [6 marks
control structure.
l10 and 20 using.for loop
numbers between
sum of odd
2
O P 213: OBJECT ORIENTED PROGRAMMING, APRIL 3021 MAIN EXANATIONS (COMP, ANG, AST,

GoMpR/6
3 d weokk
coMP R
Q11 CoMP RI5
sHUM

22 212NA7
7 6ra 213
pRoGaMMIN
G
FR

Question Seven (12 Marks)

as
oriented program the wage of labour (working on the daily basis)
Write an object to compute

per the following wage structure:

Hours Worked Rate

For first 8 hrs KSh. 50


For next 4 hrs. KSh. 10/hr

For next 4 hrs. KSh. 20/hr

For next 4 hrs. KSh. 25/hr Name

For next 4 hrs. KSh. 40/hr

The output of the program should be


like this: udunbaegrou
XXXXXXXX
OEnter Name of Employee:
hours worked: 21
puseur pnter total
KSh.310
iLpe Total Wage:

h Wok
t h a m e M p l u 7 e e

u r o o d k e r

f al fi z o

wwgemauf50
ekie 1 ( i47sta){

Nacsnt55

You might also like