Home /UOS — University of Sargodha /Object Oriented Programming

Object Oriented Programming AD/ADP/BS 2 Semester/Term University Of Sargodha (UOS) 2025

Object Oriented Programming AD/ADP/BS 2 Semester/Term University Of Sargodha (UOS) 2025 — 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

ig SATSLNg EO YY “/IUYY 2a :

EL6LEzLE-2Y0\989162Le-270 amg Baan PR

ON J38ju0) ‘aloyeq 20 ne

A Fa] =

| A | WY

\ University of Sargodha Klis) d

aweyi | |

" AD/BS 2" Semester (F-24) Examination 2025 JAW] la Gu I i (

Subject: CS/IT/SE Paper: Object Oriented Programming (CMPC-5202 |

Maximum Marks: 40 Bo

\ Time Allowed: 02:30 Hours roe

\ Note: ‘Objective part is compulsory. Attempt any three questions from subjective part. [>

' Objective Part (Compulsory) 2*8) 9 4 ~

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

® What is an abstract class? # ye

| i What is the purpose of a Constructor? # i |

i What are Access Modifiers? name any two? # 3

i% How private data members of a class are made available outside the class? gg’ |

W Write the name of two operator s that cannot be overloaded. PA

v& What is function overriding? @ ;

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

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

Subjective Part (3*8)

: : re. A

eX Write a program that creates a class Square having data megoess os sideart = rE

oS oS i mbers X and Y. Overloa

A constructor to assign values to data membe s ZL, Lr 08C © Ua anus

MMM

EL8LETLE-290\969162 6-710

‘ON Jaeju0g ‘aloyeq

"\ Time Allowed: 02:30 Hours

* Note:

A

Q.1.

University of Sargodha ADp(r7)

AD/BS 2" Semester (F-24) Examination 2025 Jawe{ia. Gu Ny

Subject: CS/IT/SE Paper: Object Oriented Programming (CMPC-5202)

Maximum Marks: 40

“oles

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

Objective Part (Compulsory)

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

: What is an abstract class? -# ®

bs What is the purpose of a Constructor?

i What are Access Modifiers? name any two?

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

Write the name of two operator s that cannot be overloaded.

vie What is function overriding? @ ¢

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

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

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 () to display the initialized attributes. Provide a mechanism to create an

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

Compare single, multiple and multilevel irheritance.

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 () 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 t

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

hen add 30% of salary as a bonus

“user-defined exception named NegativeBalanceException.

member function displayDetails() to print the account information.

an object of BankAccount class and use a try-catch block to handle any

lizing the account. Display an appropriate error message when the

Define a t

In the main() function, create

exceptions thrown when initia

exception is caught.

LK-9288/14-11-25

\

~~

~—~y

b

Ns

* ustadni.com

Papi vel JY

Ov,