Sunteți pe pagina 1din 2

PRE GTU SEMESTER EXAM

V.V.P. ENGINEERING COLLEGE, RAJKOT


B.E. IV SEM (CE)
SUB: Object Oriented Programming with C++ (2140705)
DATE: TOTAL MARKS:70

Q-1 a. Define OOP with its benefits. Differentiate between OOP & POP. [7]
b. Explain basic concepts of Object-Oriented Programming. (features of oop) [7]
c. 1. What is Reference variable? What is its major use? Give Example. [4]
2. Explain Memory Management Operators in detail. [3]
d. Explain enum and Scope Resolution Operator in detail. [7]
e. Explain Function Overloading and Inline function with the help of suitable example. [7]
Q-2 a. What is the purpose of Static? Write Characteristics of Static Data Member & Static [7]
Member Function. Write a program that demonstrates the Static Data Member & Static
Member Function.
b. Define a class Distance with real and imaginary as two data members, add necessary [7]
member functions to initialize and display data of class. Define a member function sum()
which adds two Distance objects. Invoke the statements like D3.sum (D1, D2) in main().
c. Create a class Product with Product Name, Product Code and Product Cost as three data [7]
members. Define functions to assign and display value. Define function that search a
given Product based on Code given by the user. If Product exists, print the detail of that
Product. Write a program using arrays of object. Declare at least 10 Products.
d. Explain Friend function. Also state its characteristics. Create a class Polar which [7]
describes a point in the plane using polar coordinates: radius and angle. Create another
class Rectangular which describes a point in the plane using Cartesian coordinates: x
and y. Write a program that can read values for the class objects and add one object of
Polar with another object of Rectangular. Use a friend function to carry out the addition
operation. The object stores the results may a Polar object or Rectangular object,
depending on the units in which the results are required.
Radius = sqrt (x*x + y*y) Angle = atan(y/x)
x = Radius * cos(Angle) y = Radius * sin(Angle)
e. Create a class Complex to store complex number. Overload (+) operator to add two [7]
complex numbers using friend function method.
Q-3 a. What is a constructor? Which are the special characteristics of constructor functions? [7]
Explain parameterise constructor with example.
b. What is destructor? What is the significance of using it in a program? Explain the use of [7]
destructor using a suitable program.
c. What is type conversion? Explain one class type to another type class conversion with a [7]
suitable example.
d. What is operator overloading? Write a program to overload binary plus (+) and (>=) [7]
operator to add and compare two strings.
e. What is Inheritance? Explain Multiple Inheritance in detail. [7]
Q-4 a. Consider a class network as shown in figure given below. The class Employee derives [7]
information from both Account and Admin classes which in turn derive information
from the class Person. Define all the four classes and write a program to create, update
and display the information contained in Employee objects.
b. Differentiate between method overloading and overriding with a suitable example. [7]
c. 1. Explain this Pointer. [3]
2. Write a program that handles the following exceptions: [4]
Divide-by-zero
Square-root of negative number
d. What is Exception? Write a program that demonstrates use of catching all exceptions. [7]
e. What is Polymorphism? Explain Run-Time Polymorphism in detail. [7]
Q-5 a. Explain file pointers and functions for their manipulations. [7]
b. Create a class Template Array to create and display array of 5 elements. [7]
c. Write a program that uses function templates for implementing the bubble sort [7]
algorithm.
d. Write a program, which returns size of the file in bytes. [7]
e. Explain different file mode parameter for open() with example. [3]
Write output for the following (Assume all libraries have been included): [4]
1. int main()
{ float f = -76.54321;
cout.fill (*);
cout.precision(3);
cout.setf(ios::internal, ios::adjustfield);
cout.setf(ios::scientific, ios::floatfield);
cout.width(15);
cout << f << \n; }
2. int main()
{ float f = 123.4;
cout.setf(ios::showpoint);
cout.setf(ios::showpos);
cout.precision(3);
cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::internal, ios::adjustfield);
cout.width(10);
cout << f << \n; }

S-ar putea să vă placă și