0% found this document useful (0 votes)
13 views

DIT 0503 Advanced Object Oriented Programming CAT2

The document outlines an examination for a Diploma in Information Technology, focusing on Object-Oriented Programming concepts, Java programming, and GUI application development. It includes questions on encapsulation, constructors, polymorphism, inheritance, exception handling, and Java class design. Additionally, it covers practical programming tasks such as creating a Java application and understanding access modifiers.

Uploaded by

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

DIT 0503 Advanced Object Oriented Programming CAT2

The document outlines an examination for a Diploma in Information Technology, focusing on Object-Oriented Programming concepts, Java programming, and GUI application development. It includes questions on encapsulation, constructors, polymorphism, inheritance, exception handling, and Java class design. Additionally, it covers practical programming tasks such as creating a Java application and understanding access modifiers.

Uploaded by

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

CAT 2 STAGE V EXAMINATION FOR DIPLOMA IN INFORMATION TECHNOLOGY

ANSWER ALL QUESTIONS

QUESTION 1

a) Briefly define the following Object-Oriented Programming features

i. Encapsulation
ii. Constructor
iii.Polymorphism

b) Differentiate between the following:

i. method overloading and method overriding

ii. Static binding and dynamic biding

ii) with an example Show how to declare an array in java


d) Create a Java GUI application that displays a window that is 300 pixels high by 300 pixels wide with a
button labeled “Click Me”. The button should have no functionality at this point.

( e) i) Define exception as used in Object oriented programming

ii) Give an example showing the syntax of try block and catch block with an example
iii) Explain the following keywords.
i. extends
ii. abstract
iii. iii. super
Question 2
a) Write a Java class called Invoice that a hardware store might use to represent an invoice for an item
sold at the store. An Invoice should include four pieces of information as instance variables—a part
number (type String), a part description (type String), a quantity of the item being purchased (type int)
and a price per item (type double). Your class should have a constructor that initializes the four instance
variables. Provide a set and a get method for each instance variable. In addition, provide a method named
getInvoiceAmount that calculates the invoice amount (i.e.,multiplies the quantity by the price per item),
then returns the amount as
adoublevalue.

b) i) Define the term inheritance


ii) Explain three different types of inheritance

c) Explain following methods as used in interface programming.


i. setBackground( )

ii. setForeground( )

Question 3

Write a Java application, with a class named Multiplication, which uses the command line to obtain
integers from the user and a message dialog box to display the product of the integers

the user enters.


a) Differentiate between a method with a return value and a method without a return value.
b) Your lecturer has insisted the need for using methods in developing object-oriented applications.
Briefly explain any three justifications for such advice.

c) What is garbage collection as used in java

Question Four

a) Write a simple java program that can create and display a frame named MyFrame on the
screen.

b)Citing examples discuss the three access modifiers used in OOP

c) Define polymorphism and explain how it relates to the late binding.

d) Distinguish between early and late binding

You might also like