Object Oriented Programming Using C++ 2018 Question Paper — Governmen…
The 2018 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 ENGG.
- Year: 2018
- Paper: end-term
- Duration: 180 minutes
- Total marks: 100
Instructions
- Attempt five questions in all, selecting at least two from each section.
Questions
Section A
- Q1. (i) What are the merits and demerits of friend function ? (ii) How do structures in 'C' and 'C++' differ ? How does a 'C++' structure differ from a class ? [10 marks]
- Q1 (or). What is runtime memory management ? What support is provided by C++ for this and how does it differ from C's memory management ? [10 marks]
- Q2. (a) A book-shop maintains the inventory of books that are being sold at the shop. The list includes details such as author, title, price, publisher and stock position. Whenever a customer wants a book, the sales person inputs the title and author and the system searchers the list and displays whether it is available or not. If it is not, an appropriate message is displayed. If it is, the system displays the book details and requests for the number of copies required. If the requested copies are available, the total cost of the requested copies is displayed; otherwise the message "Required copies not in stock" is displayed. Design a system using a class called books with suitable member functions and constructors. Use new operator in constructors to allocate memory space required. (b) Using the concept of pointers write a function that swaps the private data values of two objects of…
- Q3. (a) What is a copy constructor ? What are the advantages of a copy constructor ? Give examples. (b) Write a class employee with two functions get data and put data to read the name and number of employees and display them respectively. Drive two classes one manager and other scientist. In manager class add one more variable title. In scientist class add more variable publication and display them. [10 marks]
- Q4. (a) Write 'C++' class for the following : To represent two-dimensional point $(x, y)$, class should contain all different constructors and methods to print point $(x, y)$ format and also to add two points by adding their $x$ and $y$ values. (b) Write a short note on static variables and static functions. Illustrate with the help of a program. [10 marks]
Section B
- Q5. (a) What is Inheritance ? What are the types of inheritance ? How can you initialize base class member through a derived class object ? (b) What is data hiding ? What are the different mechanisms for protecting data from external users of a class's objects ? [10 marks]
- Q6. (a) What is generic programming ? How is it implemented in C++ ? (b) Write a function template to find the minimum and maximum values by passing non-type arguments to the template. [10 marks]
- Q7. (a) Write a program in C++ to compare two fractional numbers by overloading the relational operator (==, !=, >=, <=). (b) When do we use multiple catch handlers ? Write a program in C++ that illustrates the application of multiple catch statements. [10 marks]
- Q8. (a) (i) Write statements using seekg( ) to achieve the following : (a) To move the pointer by 15 positions backward from current position. (b) To go to the beginning after an operation is over. (c) To go backward by 20 bytes from the end. (d) To go to byte number 50 in the file. (ii) Describe the various approaches by which we can detect the end-of-file condition successfully. (b) Write a program that reads a text file and creates another file that is identical except that every sequence of consecutive blank spaces is replaced by a single space. [10 marks]