Object Oriented Programming Using C++ 2022 Question Paper — Governmen…
The 2022 Object Oriented Programming Using C++ previous year question paper (Government College of Engineering and Technology, Jammu), with every question and its marks.
- University: Government College of Engineering and Technology, Jammu
- Subject: Object Oriented Programming Using C++
- Course: Object Oriented Programming Using C++
- Branch: Computer/IT Engg
- Year: 2022
- Paper: end-term
- Duration: 180 minutes
- Total marks: 100
Instructions
- Attempt five questions in all selecting at least two questions from each Section.
- Each question carries 20 marks.
Questions
Section - A
Attempt at least two questions from each Section.
- QQ1. (a) Discuss how data and functions organized in an object oriented paradigm. List major areas of application of OOP. (10) (b) Differentiate between the following terms with suiable examples :- (i) Abstraction and Encapsulation (10) (ii) Function Overloading and Function Overriding [20 marks]
- QQ2. (a) Create a class time that has separate int member data for hour, minutes and seconds. One constructor should initialize this data to 0 and another should initialize it to fixed values. A member function should display it in 11:59:59 format. The next member function should add two objects of type time passes as arguments. A main() function should create 2 initialized time objects and one that is not initialized. Then it should add two initialized values together, leaving the result in third time variable. Finally should display the value of this third variable. (10) (b) Discuss the various uses of scope resolution operator by giving suitable examples. (10) [20 marks]
- QQ3. (a) Differentiate between friend and inline functions. Explain with an example. (10) (b) Write note on following with suitable example :- (i) Visibility modes in classes (10) (ii) Static Class member [20 marks]
- QQ4. (a) Explain dynamic memory management. Write a C++ program demonstrating the usage of new and delete operators for a single variable as well as for an array. (10) (b) How a constructor varies from normal member function? In what order are class constructors and destructors called when a derived class object is created? Illustrate with an example. (10) [20 marks]
Section - B
Attempt at least two questions from each Section.
- QQ5. (a) "Overloading is a type of polymorphism". Elaborate the given statement with the help of suitable example using the concept of function overloading. (10) (b) Write a program in C++ to declare the examination results. Design three classes : Student, Exam, Result. The Student class has the data members such as Rollno and Name. Create the class Exam by inheriting the Student class. The Exam class adds the data members representing the marks scored in six subjects. Derive the Result from Exam class and it has its own data members such as Total_marks. What type of inheritance this model belongs to. (10) [20 marks]
- QQ6. (a) Does multiple inheritance leads to ambiguity? If yes, discuss by putting up suitable scenario how it can be removed. (10) (b) Justify the following statement with the help of a suitable example :- "In a class hierarchy of several levels if we want a function at any level to be called through a base class pointer then the function must be declared as virtual in the base class." (10) [20 marks]
- QQ7. (a) Discuss the features of a function template. Write a C++ program to create a function template for finding maximum number out of given numbers. (10) (b) What is a user defined exception. Write down the scenario where we require user defined exceptions. (10) [20 marks]
- QQ8. (a) Explain the role of seekg(), seekp(), tellg(), tellp(), function in the process of random access in a file. (10) (b) Write a C++ program involving working with a single file. Use ifstream and ofstream classes to write and read the information to and from a file using operators:- << and >>. Show how a file can be opened and closed. (10) [20 marks]