0% found this document useful (0 votes)
44 views3 pages

Oop With.c++ - 5-12-18

This document contains an exam for an Object Oriented Paradigm with C++ course. It consists of 5 questions testing various concepts related to classes, objects, inheritance, polymorphism, and exception handling in C++. The questions cover topics like class diagrams, reference variables, constructor functions, function overloading, dynamic binding, and defining classes to store and manipulate distance values. Students are instructed to answer any 2 out of 3 sub-questions for each question in 3 hours.

Uploaded by

pegena7848
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views3 pages

Oop With.c++ - 5-12-18

This document contains an exam for an Object Oriented Paradigm with C++ course. It consists of 5 questions testing various concepts related to classes, objects, inheritance, polymorphism, and exception handling in C++. The questions cover topics like class diagrams, reference variables, constructor functions, function overloading, dynamic binding, and defining classes to store and manipulate distance values. Students are instructed to answer any 2 out of 3 sub-questions for each question in 3 hours.

Uploaded by

pegena7848
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DR.

BABASAHEB AMBEDKAR TECHNOLOGICAL UNI\/ERSITY, LONERE


End Semester Examination - Winter 2018

Subject Name: Object Oriented Paradigm with C++ Subject Code: BTITC303
Max Marks: 60 Date:05/12l18 Duration: 3 Hr.
Instructions to tlte Studenls:
1. All que,stions are compulsory.
2. The level question/expected answer as per OBE or the Cottr,se Oulcome (CO) on
which lhe question is based is mentioned in front of the question.
3. Use of non-programmable scientific calctrlators is allowed.
4. A,ssume suitable data wherever nece,\sary.and mention it clearly.
(Level Marks
/co)
Q.I Solve Any Two of the following.
A) What is an algorithm? What is/are the need(s) of writing algorithm? COl 6

What is class diagram? What are the components of class diagram? Explain
with the help of diagram.
B) What is reference variable? What is its rnajor use? CO5 6

Write a function using reference variable as argument to sr,vap the values of pair
of integers.
C) i. Enumerate the rules of naming variables in C++. How do they diff-er fiom CO5 6

ANSI C rules?
ii. Describe the major parts of C++ program. How does a main function in C++

differ from rnain 0 in C?


Identify error in the following program
#include <iostream.h>
void main0
I
I

short i:2500, j:3000,


collt))" i +j :" >>-(i +j);
i
I

Q.2 Solve Any Two of the following.


A) A friend function cannot be Lrsed to overload the assignment operator:. COs 6

Explain why? When is a friend function compulsory? Give an example.

44527 06 A t5 C42C8064E A682D AF 4939 I C


B) What is constructor? Is it irrartclatory to use constructors in a class? gol,clo
we cC)3
invoke constructor function? List s.qme oflhe specialproperties of the
constructor functions. Can we use more than one constructor in a class? yes,
If
explain the need of such a situation.
C) What is type conversion?
c03
A class alpha has a constructor as follows: alpha (int a, double b);Can
we use
this constructor to conveft types?
We have two classes X and Y. If a is an object of X and b is an object
of y and
we want to say a:b; what type of conversion routine should be used
and
where?

Q.3 Solve Any two of the following.


A) i. what is a virtual function? why do we need virtual functions? when do we
c03
make a virtual function "pure"? what are the implications of making
a c04
function a pure virtual function?

ii. What is an exception? How is an exception handled in C++? What are the
advantages of using exception handring mechanism in a program?
when should
a program throws an exception?

B) what do you mean by function overloading? Explain with an example when


do co4
we use this concept.
on what basis, the compiler distinguishes between a set of overloaded

functions having the same name?


c) write a function to read a rnatrix of size m*n from the kevboard.
co2 6

Q.4 Solve Any Two of the following.


A) Distinguish between the following terms:
c02
i. Objects and classes
ii. Data abstraction and data encapsulation co3
iii. Inheritance and polymorphism
iv. Dynarnic binding and message passing
co4
co5
B) What does polymorphism rreans in C++ language? How polymorphism
c04
achieved at i. Compile time ii. Run time?
c) Define a class String. Use overload :: operator to compare two strings. c02

44 527 06 A t5 C42C8064E A682D AF 4939 I C


Q.5 Solve Any One of the following.
A) i. What does inheritance mean in C++? CO3 12

:'Class'DisderivedfromclassB.TheclassDdoeSnotcontainanydata
members of its own. Does the class D require constructors? If yes, why?

What is containership? How does it differ from inheritance?


Describe how an object ofa class that contains objects ofother classes created?
ii. What are the different forms of inheritance? Give an example for each.

iii. We know that a private member of a base class is not inheritable. Is it


anyway possible for the objects of a derived class to access the private
members of the base class? If yes, how? Remember, the base class cannot be

modified.
B) Creatstwociasses DMandDB which storesthe value of distances. DM stores CO2 12

distances in meter and centimeters and DB in feet and inches. Write a program
that can read values for the class objects and add one object of DM with

another object of DB.

Use friend function to carry out the addition operation. The object that stores

the results may be DM object or DB object, depending on the units in which the
results are required. The result should be in the format of feet and inches or
meters and centimeters depending on the object on display.

,rjrrr End r<rtrr

44s27 06 A1 5C42C8064EA682DA tr4939 I C

You might also like