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

2 Hours Instructions: Question One Other Two

The document outlines the examination details for various Bachelor of Science degrees in Information Technology and related fields, scheduled for December 2023. It includes instructions for answering the exam questions, which cover topics such as C++ programming, object-oriented programming principles, and specific programming tasks. The questions require students to demonstrate their understanding of loops, variable handling, method prototypes, and class implementation in C++.

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)
7 views2 pages

2 Hours Instructions: Question One Other Two

The document outlines the examination details for various Bachelor of Science degrees in Information Technology and related fields, scheduled for December 2023. It includes instructions for answering the exam questions, which cover topics such as C++ programming, object-oriented programming principles, and specific programming tasks. The questions require students to demonstrate their understanding of loops, variable handling, method prototypes, and class implementation in C++.

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 IN


INFORMATION TECHNOLOGY//BUSINESS INFORMATION
TECHNOLOGY/APPLIED COMPUTING/ SOFTWARE
DEVELOPMENT/ INFO. SECURITY AND FORENSICS
BIT 2108/ BBIT 203/BAC 2101/BSD 2102/BISF 2101:
OBJECT ORIENTED PROGRAMMING
PART TIME/FULL TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: DECEMBER, 2023 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One and Any Other Two.

QUESTION ONE [20 MARKS]

a) With the help of a well written C++ program, explain the difference between while and do…while
loop. Write the expected outputs of the programs 6 Marks
b) Differentiate between variable declaration and variable initialization. Explain the difference
between compile-time initialization and Run-time initialization 2 Marks
c) Describe any THREE uses of a method prototype. 3 Marks
d) Explain the purpose of using namespace std; 2 Marks
e) Using an example of a program differentiate between pass by value and pass by reference with
regard to method calling in C++. 5 Marks

QUESTION TWO [15 MARKS]


a) Write a C++ program that will implement a class named compute with three integers initialized to
3,6 and 9 respectively and a member method used to determine and output the product of these
integers. Use parameterized constructors. 8 Marks
b) Write a C++ program that uses switch case to perform arithmetic operations on two operands keyed
by the user using the criteria below:

Operator Operation
+ Display sum and exit
- Display difference and exit
* Display product and exit
/ Display quotient and exit

7 Marks
QUESTION THREE [15 MARKS]
a). Differentiate between method overloading and operator overloading in object oriented
programming. 2 Marks
b). Explain how each of the following principles in object oriented programming are implemented
in C++ language.
i.Abstraction
ii.Encapsulation
iii.Polymorphism
iv.Inheritance 8 Marks
c). Define constructor and explain any FOUR attributes of a constructor in a C++ language.
5 Marks
QUESTION FOUR [15 MARKS]
Write the code of a class named EXAM with following description.
Private Members;
• exmCode of type string, 6 characters.
• xmDescription of type string, 40 characters.
• noCandidate of type integer.
• centersReqd (number of centers required) of type integer.
• A member function CALCNTR( ) to calculate and return the number of centers as
(noCandidates/100+1).
Public Members;
• A function SCHEDULE() to allow user to enter values for exmCode, xmDescription,
noCandidate and call function CALCNTR( ) to calculate the number of centers.
• A function SHOW() to allow user to view the content of all the member data. (The functions
should be prototyped within the class and their definitions placed outside the class).
Include the main method (entry point) from which the class can be instantiated.

You might also like