Object Oriented Programming BS/MPhil Computer Science/MS Computer Science 2 Semester/Term UOS — University of Sargodha 2024
Discussion
Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.
No questions yet — be the first to ask.
More Object Oriented Programming papers
See all
Object Oriented Programming AD/ADP/BS 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 2 months ago · by Jaweria Gull
Download ↓
Object Oriented Programming AD/ADA/BS 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 4 months ago
Download ↓
Object Oriented Programming Msc IT 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 10 months ago
Download ↓
University of Sargodha AD/BS 2nd Semester (F-24) Examination 2025 Paper: Object Oriented Programming (CMPC-5202)
Uploaded 11 months ago
Download ↓
University of Sargodha AD/BS 2"d Semester (F-24) Examination 2025 Subject: CSAT/SE Paper: Object Oriented Programming (CMPC-5202)
Uploaded 11 months ago
Download ↓
Object Oriented Programming ADP 3 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 1 year ago
Download ↓
Paper text
Subject: Computer Science
University of Sargodha
BS 2nd Term Examination 2024
Paper: Obiect Oriented Programming (CMPC-102)
(For Regular & Retake Students)
Time Allowed: 02:30 Hours
Maximum Marks: 40
Note: Objective part is compulsory. Atfempt any three questions from subjective part.
Q.1.
Q.z.
Q.3.
Q.4.
Objective Part
(Compulsory)
Write short answers of the following in 2-3 lines each on your answer sheet.
What is an abstract class?
Can a conversion operator be static function? Justify your answer.
What is the purpose of delete operator?
Can a constructor be overloaded?
What is multiple inheritance?
Can we change operator associativity by overloading it?
What is polymorphism and its advantage?
What are try and catch blocks in exception handling?
(2*8)
Subjective Part
(3*8)
Q.5.
Q.6.
Create a class Rectangle having data members (length and width) each of which is defaults to 1. All
the data members should be private. Write down no argument and 2 argument constructors. Also,
write down get and set functions as well as printArea function.
Create a class Rational Numbers having data members (numerator, denominator). Overload
operators to add, subtract and compare two Rational numbers. Also overload output operator (<<)
to display a rational number as (numerator/denominator) like 3/8.
Create a class Teacher having data members (name, age, address). Also, write down constructor,
get and set functions. Create another Author having data member (numberOfBooks). It also
contains constructor, get and set functions. Now write down a third class Scholar that inherits both
Teacher and Author classes. Also, write down constructor, get and set functions for Scholar class.
Create an abstract class animal (name, age). Inherit two classes Zebra (place of origin) and Dolphin •
from it. Write appropriate constructors, setO and get functions for each class. Then write an
application that creates objects of these two classes, places pointers to these objects in an array of
animal pointers, then iterate through the array, polymorphically invoking each object's get and set
member functions.
Write down a class Time having data members (hrs, mins, sees) containing overloaded stream
insertion and extraction operators. The program should also contain the function to read and write
object on file. Exceptions should be thrown if mins or secs are greater than 60.
- IK-6979/15-11-24