Gujarat Technological University
Gujarat Technological University
Gujarat Technological University
___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–IV(NEW) – EXAMINATION – SUMMER 2019
Subject Code:2140705 Date:25/05/2019
Subject Name: Object Oriented Programming With C++
Time:02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
Q.1 (a) Explain the concept of data abstraction and encapsulation in OOP. 03
(b) Describe the concept of enumerated data Type in C++ with a proper 04
example.
(c) What is call by reference and return by reference? Explain with a 07
suitable example.
Q.3 (a) Explain basic to class type conversion with appropriate example. 03
(b) Write a program to find out product of two private data members p 04
and q of two classes X and Y using a common friend function.
Assume that the prototype for both the classes will be: void
product(X, Y);
(c) What is a constructor? Explain different types of constructors with 07
an appropriate example.
OR
Q.3 (a) Explain inline function with suitable example. 03
(b) What is the use of destructor in C++? Explain with a suitable 04
example.
(c) Explain runtime polymorphism. Explain and demonstrate, how 07
virtual function to achieve runtime polymorphism?
1
(c) Write a following C++ program to explain objects as function 07
arguments. Define a class name “Point” with two data member
variable x and y, member function for getting the value of member
variable from user and second member function for displaying the
value of member variable. Define third member function that takes
another Point object as an argument and returns the Euclidean
distance between the two Point objects. [for point P(x1,y1) and point
Q(x2,y2) Euclidean distance = sqrt((x2-x1)2 + (y2-y1)2)]
Q.5 (a) Describe various stream classes for console I/O operations. 03
(b) Write a C++ program to handle Exception “division by zero” 04
situation.
(c) What is the general format of function template? Write a C++ 07
program for bubble sort using template functions.
OR
Q.5 (a) Explain ios::app, ios::ate and ios::trunc flags. 03
(b) Write a program for swapping two values of different data types 04
using template.
(c) Explain STL with its core components. 07
*************