0% found this document useful (0 votes)
20 views3 pages

OOP UE March 2021

Uploaded by

jackson lymo
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)
20 views3 pages

OOP UE March 2021

Uploaded by

jackson lymo
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/ 3

DEPARTMENT OF INFORMATICS

__________________________

BACHELOR OF COMPUTER SCIENCE/INFORMATION TECHNOLOGY


YEAR II (BCS/BIT II)

ITU07322: OBJECT-ORIENTED PROGRAMMING

FINAL EXAMINATION

ACADEMIC YEAR 2020/2021

_____________________________

DATE: March 09, 2021 TIME ALLOWED: 3 HOURS


------------------------------------------------------------------------------------------------------------

GENERAL INSTRUCTIONS:
1. There are FIVE questions in this paper.
2. Attempt ALL questions.
3. Do not write anything on the question paper.
4. You are reminded to adhere to ALL Institute’s Examination Regulations.
5. Do not use your name or registration number as name of class, method,
variable, value or file anywhere in Java applications.
6. This examination consists of THREE printed pages.

1
Question One
Differentiate between each of the following pairs of object-oriented programming
concepts:
(a) Instance variable and class variable [4 marks]
(b) Main class and client of class [4 marks]
(c) Non-static method and static method [4 marks]
(d) C and Java [4 marks]
(e) Modifier and operator [4 marks]

Question Two
Using your answer booklet, fill in the blanks in each of the following statements:
i. ________________ is a memory location where data are stored for use in a
computer program.
ii. A programming style that allows developers to group similar tasks into classes
is called a(n) _________________.
iii. _________________ are used to document a program and improve its
readability.
iv. A(n) _________________ is a bundle of software that contains variables and
related methods.
v. _________________ is used to provide the default values to object like 0,
0.0, null, etc. depending on the type.
vi. A variable or a value on which operator operates is called _______________.
vii. Keyword _________________ specifies that a variable is not modifiable.
viii. A(n) ______ variable represents classwide information that is shared by all
the objects of the class.
ix. _________________ is the ability of an object to take on many forms.
x. A(n) ______________________ is an indication of a problem that occurs
during program's execution. [@ 2 marks]

Question Three
Write short notes on:
(a) Selection control statements [5 marks]
(b) Repetition control statements [5 marks]
(c) Encapsulation [5 marks]
(d) Inheritance [5 marks]
2
Question Four
Create a class called Parallelogram that includes two pieces of information as
instance variables – a base (type double) and a height (type double). Your class
should have a constructor that initializes the two instance variables. Provide a set
and a get method for each instance variable. In addition, provide a method named
calculateArea that calculates the area, then returns the area as a double value.
Write a test application named ParallelogramTest that demonstrates class
Parallelogram’s capabilities. Use the following formula for the area of the
parallelogram:
area = bh [20 marks]

Question Five
Create a class called Member that includes three pieces of information as instance
variables – a full name (type String), age (type int) and salary (type double). Your
class should have a constructor that initializes the three instance variables. Provide
a method called printMemberDetails for displaying member’s details. The class
Manager inherits from class Member and defines one more additional piece of
information as its instance variable – department (type String). Write a test
application named ManagerTest that demonstrates class Manager’s capabilities.
[20 marks]

You might also like