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

University of Sargodha AD/BS 2"d Semester (F-24) Examination 2025 Subject: CSAT/SE Paper: Object Oriented Programming (CMPC-5202)

University of Sargodha AD/BS 2"d Semester (F-24) Examination 2025 Subject: CSAT/SE Paper: Object Oriented Programming (CMPC-5202) — 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

AD/BS 2"d Semester (F-24) Examination 2025

Subject: CSAT/SE

Paper: Object Oriented Programming (CMPC-5202)

Time Allowed: 02:30 Hours

Maximum Marks: 40

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

Objective Part

Q.1.

(Compulsory)

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

What is an abstract class?

ii.

iii.

iv.

V.

vi.

vii.

V1l1.

What is the purpose of a Constructor?

What are Access Modifiers? name any two?

How private data members of a class are made available outside the class?

Write the name of two operators that cannot be overloaded.

What is function overriding?

Can a constructor call another constructor using this keyword? Give example.

How many destructors can be defined in a class? Argue with reasoning.

(2*8)

Q.2.

Q.3.

Q.4.

Q.5.

Q.6.

Subjective Part (3*8)

Write a program that creates a class Square having data members as sides X and Y of Square. A

parameterized constructor to assign values to data members X and Y, Overload comparison operator

to compare side of two square class objects and display message in main that two of the square

objects are equal or not.

Write a complete program to create a class called Account with protected attributes such as account

number and balance. The attributes should be initialized through constructors. The class contains a

public method named as show 0 to display the initialized attributes. Provide a mechanisma to create an

array of Account objects. The array size should be given by the user at run time.

Compare single, multiple and multilevel inheritance.

Create a class employee with four data members emp_ name, emp_salary, emp_scale, bonus.

Create the following members functions

A Constructor to assign initial values to data members.

getdetail O to initialize the data members

showdetail to display the values of data members

addbonus to add the bonus in salary. If emp scale is 17 or greater then add 30% of salary as a bonus

in salary, other wise if the scale is less then 17 the add bonus 15%.

withbonus following function will display the salary after adding the bonus.

Write a C++ program to simulate a Bank Account system using exception handling.

Create a class BankAccount with the following data members:

Acc name (string), Acc_num (string or int), and Acc_balance (float or double).

Add a constructor to initialize all data members. If the user tries to enter a negative balance, throw a

user-defined exception named NegativeBalanceException,

Define a member function displayDetails) to print the account information.

In the main function, create an object of Bank Account class and use a try-catch block to handle any

exceptions thrown when initializing the account. Display an appropriate error message when the

exception is caught.

-- LK-9288/14-11-25-