Home /University Of Sargodha (UOS) /Object Oriented Programming

University of Sargodha ADP 31ª Semester Examination 2025 Subject: IT Paper: Obiect Oriented Programming (CMPC-201)

University of Sargodha ADP 31ª Semester Examination 2025 Subject: IT Paper: Obiect Oriented Programming (CMPC-201) — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

More Object Oriented Programming papers

See all

Paper text

University of Sargodha

ADP 31ª Semester Examination 2025

Subject: IT

Paper: Obiect Oriented Programming (CMPC-201)

Time Allowed: 02:30 Hours

Note: Objective part is compulsory. Attempt any three questions from subjective part.

Maximum Marks: 40

Objective Part

(Compulsory)

Q.1. Write short answers of the following in 2-3 lines each on your answer sheet.

Does Java support Multiple Inheritance.

Differentiate between method overloading and method overriding.

ії.

iv.

Explain the difference between checked and unchecked exceptions.

What is Object Serialization?

What is the purpose of finally block?

Vi.

-Can a constructor be overloaded?

Can one try block have multiple catch blocks?

vin.

Differentiate between component and container.

(2*8)

Q.4.

Q.5.

Q.

Subjective Part

Define a class BankAccount with fields accountNumber, balance, and accountHolderName. Write

down three-argument constructor. Also, implement methods to deposit, withdraw, and display

account details.

(8)

Write a program to implement an abstract class Shape with two abstract methods area and

perimeter. Derive classes Circle (having data member radius) and Rectangle (having data member

length and width) implementing the area and perimeter) method. In both classes add appropriate

constructors as well.

Area of Circle = PI * (radius)

Perimeter of Circle = 2 * PI * radius

(8)

Area of Rectangle = (length*width) Perimeter of Rectangle = 2 (length + width)

Explain Exception Handling in Java with an example program handling ArithmeticException and

ArrayIndexOutOfBoundsException.

a) Explain Aggregation in Java with an example.

/b) What is the significance of the static keyword in Java?

(3)

Create a class Rational having fields num and denum. Include two argument constructor, get and

printO methods. The get should throw exception if entered denominator is ZeTo, Finally, write an

application that uses Rational class. Instantiate two objects and then call get and displayO method

for each object.

(8)

- LK-6562/29-05-25 -