Object Oriented Programming BSCS 2nd Term 2015 Past Paper UOS

University of Sargodha
BS 2nd Term Examination 2015
Subject: Computer Science
Paper: Object Oriented Programming (CMP:2124)
Time Allowed: 2:30 Hours
Maximum Marks: 60
Objective Part (Compulsory)
Q.No. 1: Attempt all parts and each require answer 2 – 3 lines (12*2=24)
- What is Object-oriented programming?
- Explain Encapsulation concept in Object-oriented programming.
- What is an abstract class?
- Write the syntax of class declaration.
- Which Member functions do not needed to be called by object and why?
- What is the purpose of Destructor?
- Different between method overriding and method overloading?
- Define Inheritance?
- What are Friend functions? Write the syntax of declaring a friend function.
- What is dynamic binding or late binding?
- What is the purpose of try and catch blocks?
- What is an object?
Subjective Part (4*9=36)
Q. No. 2
Write a class car that contains attributes of car’s name (type string), top speed (type float) and model name (type string). A Constructor with no arguments initializes the data members and two member functions to input and display these attributes.
Q. No. 3
Define Shape class and two subclasses of it, Rectangle and Oval. Use draw function to demonstrate polymorphic behavior by using these classes.
Q. No. 4
What is operator overloading? Overload insertion and extraction operator for a time class.
Q. No. 5
Imagine a tollbooth with a class called Tollbooth that has attributes total_number_of_cars (int) and total_amount (double). Write down a two parameter constructor and an Input member function in this class. Read two objects and store into a text file “tollbooth.txt”.
Q. No. 6
Describe the function template and class template. Discuss with the help of an example.
Q. No. 7
Explain following with example
i. Polymorphism
ii. Dynamic Memory Management