OOP - Object Oriented Programming, Past Papers

Object Oriented Programming BSCS 2nd Term 2015 Past Paper UOS

University of Sargodha 2015 BS 2nd Term Exam Paper for Object Oriented Programming CMP:2124, including key questions on encapsulation, inheritance, polymorphism, operator overloading, and class templates

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)

  1. What is Object-oriented programming?
  2. Explain Encapsulation concept in Object-oriented programming.
  3. What is an abstract class?
  4. Write the syntax of class declaration.
  5. Which Member functions do not needed to be called by object and why?
  6. What is the purpose of Destructor?
  7. Different between method overriding and method overloading?
  8. Define Inheritance?
  9. What are Friend functions? Write the syntax of declaring a friend function.
  10. What is dynamic binding or late binding?
  11. What is the purpose of try and catch blocks?
  12. 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