Dit-Sep-2022-Object Oriented Programming

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

DIT SEP 2022

REGIONAL CENTRE TRAINING INSTITUTE (RCTI)

DIPLOMA IN INFORMATION TECHNOLOGY

STAGE 2 TERM 1

EXAMINATION
APRIL 2024 SERIES

OBJECT ORIENTED PROGRAMMING


Duration: 3 Hours

INSTRUCTIONS

1. Attempt all questions (change depending of exam series)


2. Every Questions Carries 20 Marks
3. Show ALL your workings
4. Only a silent, Non- Programmable calculator may be used in this examination
5. Mobile phones are not allowed in the examination room
6. No reading or external writing materials are allowed into the examination room
7. No communication is allowed except with the express permission of the Invigilator
8. Observe all Center’s examination rules and regulations

Candidates should check the question paper to ascertain that all pages are printed as indicated and
that no questions are missing

Shadrack Kodondi
QUESTION ONE

a) Describe the role of access modifiers public, private, protected in controlling


access to class members (6 marks)
b) List FOUR rules for writing identifiers (4 marks)
c) Mention FOUR features of the OOP language (4 marks)
d) Explain three characteristics of an object (3 Marks)

e) Write a program in C++ that allows a user to enter the dimensions of a right
angled tringle and outputs its perimeter. Use appropriate data members and
one function (3
Marks)

QUESTION TWO

a.) List THREE disadvantages of using C++ language (3 marks)


b.) Differentiate between token and identifiers as used in programming (4 marks)
c.) Explain any TWO advantages of OOP over Structured Programming (4 marks)
d.) The program below shows C++ program structure. Name the different section
labeled (i-viii) (9 marks)

2
QUESTION THREE

a.) Determine the output of the following program written in C++ (3


marks)

b.) Explain the purpose of using the namespace std in C++ programs (2
marks)
c.) List any FOUR derived data types as used in C++ program (2
marks)
d.) State one advantage and one disadvantage of using inline functions in OOP
(2 marks)
e.) Using sample code, Implement a class named rect from the base class Sqr
(3
Marks)
f.) using code samples, demonstrate three different types of inheritance (6
marks)
g.) Differentiate between derived class and parent class as used in object-oriented
programming (2Marks)

QUESTION FOUR
a.) Explain the circumstances under which the following data types are most
applicable in OOP (2 marks)
i.) struct

3
ii.) class
b.) Explain the term encapsulation as used in OOP (2 marks)

c.) Explain the following terms as used in OOP


i.) Instantiation (2 marks)
ii.) access specifiers (2 marks)

d.) Describe the circumstances under which the following C ++ program elements
are most applicable:
i) Scope resolution operator (2 marks)
ii) Object parameter (2 marks)

e.) Outline FOUR reasons why OOP is popular in software development (4


marks)
f.) Outline FOUR categories of operators as used in C++ giving an example in each
case (4
marks)

QUESTION FIVE

a.) List FOUR built-in/primary data types as used in C++ program (2


marks)
b.) Mention TWO types of functions found in C++ language (2
marks)
c.) Distinguish between a function and an inline function in C++ programs (4
marks)
d.) Distinguish between structure and classes as applied in C++ programs (3
marks)
e.) Outline FIVE characteristics of OOP language (5
marks)

The following code was written by a student. Use it answer the questions that
follow. Identify any THREE bugs in the code snippet and rewrite the code by

4
correcting the errors
(2 marks)

You might also like