Subject Name: Object Oriented Programming with C++ Subject ...

19
L.J. Institute of Engineering & Technology Semester: IV (2016) OOCP(2140705) 2016 Page 1 Subject Name: Object Oriented Programming with C++ Subject Code:2140705 Faculties: Sr. No CHAPTER NO- 1 : Concept of OOP : Marks TOPIC:1 Introduction of OOP SHORT QUESTIONS 1 Define Encapsulation. [L.J.I.E.T]. 1 2 Define Data Abstraction. [L.J.I.E.T]. 1 3 Define Inheritance. [L.J.I.E.T]. 1 4 Which of the following concepts of OOPS means exposing only necessary information to client? a. Encapsulation b. Abstraction c. Data Hiding d. Data binding [L.J.I.E.T]. 1 DESCRIPTIVE QUESTIONS 1 Compare structured programming with object oriented programming.. [L.J.I.E.T]. 3 2 Explain: Abstraction and Encapsulation. [L.J.I.E.T]. 3 3 Explain the concept of Class, Object, Polymorphism and Inheritance. [L.J.I.E.T]. 4 (24-12-08) 4 Explain structure of class with example. [L.J.I.E.T]. 5(24-12-2008) 5 Explain features of object oriented programming language.[L.J.I.E.T]. 7(17-03-2009) 7(30-12-2013) 6 Define Following a) Define following terms I. Class II. Object III. Dynamic binding IV. Polymorphism V. Destructor [L.J.I.E.T]. 5(10-06-2009) 7 Give comparison of 1. C and C++ Programming language. [L.J.I.E.T]. 7(4 -1-2010) 8 State the benefits of object oriented programming over procedure oriented programming. [L.J.I.E.T]. 7(4-1-2010) 9 Explain following Object Oriented Programming Terms in detail. 1) Data Abstraction 2) Polymorphism. [L.J.I.E.T]. 4(8-09-2009) 10 Give comparison of 1. C and C++ Programming language. 2. How does main() function in C differ from C++? Give General format of Class. [L.J.I.E.T]. 3.5(4-1-2010) 2(17-6-2013) 11 Describe the features of OOP Language. [L.J.I.E.T]. 7 (04-01-2010)

Transcript of Subject Name: Object Oriented Programming with C++ Subject ...

Page 1: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 1

Subject Name: Object Oriented Programming with C++

Subject Code:2140705

Faculties:

Sr.

No CHAPTER NO- 1 : Concept of OOP : Marks

TOPIC:1 Introduction of OOP

SHORT QUESTIONS

1 Define Encapsulation. [L.J.I.E.T]. 1

2 Define Data Abstraction. [L.J.I.E.T]. 1

3 Define Inheritance. [L.J.I.E.T]. 1

4 Which of the following concepts of OOPS means exposing only necessary

information to client?

a. Encapsulation

b. Abstraction

c. Data Hiding

d. Data binding [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Compare structured programming with object oriented programming.. [L.J.I.E.T]. 3

2 Explain: Abstraction and Encapsulation. [L.J.I.E.T]. 3

3 Explain the concept of Class, Object, Polymorphism and Inheritance. [L.J.I.E.T]. 4 (24-12-08)

4 Explain structure of class with example. [L.J.I.E.T]. 5(24-12-2008)

5 Explain features of object oriented programming language.[L.J.I.E.T]. 7(17-03-2009)

7(30-12-2013)

6 Define Following

a) Define following terms

I. Class

II. Object

III. Dynamic binding

IV. Polymorphism

V. Destructor [L.J.I.E.T].

5(10-06-2009)

7 Give comparison of

1. C and C++ Programming language. [L.J.I.E.T]. 7(4 -1-2010)

8 State the benefits of object oriented programming over procedure oriented

programming. [L.J.I.E.T].

7(4-1-2010)

9 Explain following Object Oriented Programming Terms in detail.

1) Data Abstraction 2) Polymorphism. [L.J.I.E.T].

4(8-09-2009)

10

Give comparison of

1. C and C++ Programming language.

2. How does main() function in C differ from C++? Give General format of

Class. [L.J.I.E.T].

3.5(4-1-2010)

2(17-6-2013)

11 Describe the features of OOP Language. [L.J.I.E.T]. 7 (04-01-2010)

Page 2: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 2

12 Distinguish between programming languages “C” and “C++”.[L.J.I.E.T]. 7(02-01-2010)

13 List out basic concepts of Object –Oriented Programming explain each in detail. 7(31-03-2010)

7(02-01-2015)

14 Explain basic concepts of Object-Oriented Programming. [L.J.I.E.T]. 7(17-06-2013)

15 Describe any two characteristics of OOP. [L.J.I.E.T] 4(05-06-2015)

16 Write the basic structure of a C++ program with all necessary

blocks. . [L.J.I.E.T].

6(25-06-2014)

TOPIC:2 Procedural vs Object Oriented Programming

SHORT QUESTIONS

1 You can use C++ as a procedural, as well as an object -oriented, language

a. True

b. False

c. May be

d. None of above [L.J.I.E.T].

1

2 ___________________ concepts means wrapping up of data and functions together.

[L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Differentiate between Procedure Oriented Paradigm and Object Oriented

Paradigm.[L.J.I.E.T]. 3

2 Give the difference between object oriented language and procedure oriented

language. [L.J.I.E.T]. 4

(24-12-2008)

3 Define Object and Class and Give comparison of Object Oriented Language and

Procedural Language. [L.J.I.E.T].

7(4-1-2010)

4 Define Object and Class and Give comparison of Object Oriented Language and

Procedural Language. [L.J.I.E.T].

7(04-01-2010)

7(25-06-2014)

5 Write the short notes on following. [L.J.I.E.T].

(ii) Difference between Object Oriented and Procedure Oriented language.

4(05-01-2011)

6 Compare following.

Object and Procedure oriented programming. [L.J.I.E.T]. 3.5 (23-06-

2011)

TOPIC:3 Priciples of OOP , Benefit and Application of OOP

SHORT QUESTIONS

1 Which of the following approach is adapted by C++?

a. Top-down

b. Bottom-up

c. Right-left

d. Left-right [L.J.I.E.T].

1

2 Define Reusability . [L.J.I.E.T] 1

DESCRIPTIVE QUESTIONS

1 Explain the Principles of OOP. [L.J.I.E.T]. 7

2 Explain the applications of OOP. [L.J.I.E.T]. 7

3 Describe the features of OOP Language[L.J.I.E.T]. 7(4-1-2010)

4 List benefits of OOP. [L.J.I.E.T]. 4(05-06-2015)

Page 3: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 3

5 Explain the benefits of Object Oriented Programming. [L.J.I.E.T]. 7(04-01-2016)

CHAPTER NO- 2 : C++ Basics :

TOPIC:1 Overview, Program Structure, Namespace, Identifier

SHORT QUESTIONS

1 cout is a/an __________ .

a. operator

b. function

c. object

d. macro [L.J.I.E.T].

1

2 Which of the following is an abstract data type?

a. int

b. double

c. string

d. class [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 What is a User Defined Data type? What is the scope and life time of variable?

Explain using C++ program[L.J.I.E.T]. 7(4-01-2010)

2 Give comparison of Static Memory Allocation and Dynamic Memory Allocation with

a code snippet. [L.J.I.E.T]. 7(4-01-2010)

TOPIC:2 Variable, Constant,Enum,Operators, Type Casting ,

Control Structures

SHORT QUESTIONS

1 List out memory allocation Operator. [L.J.I.E.T]. 1

2 Define : Reference Variable. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Explain following with example w. r. to C++.

1. new operator 7(23-06-2011)

2 Explain Scope Resolution Operator with example. [L.J.I.E.T]. 3(17-6-2013)

3 Describe various operators in C++.[L.J.I.E.T]. 7(30-12-2013)

7(02-01-2015)

4 Explain generic pointer. [L.J.I.E.T]. 2(17-6-2013)

5 How do they differ ? :

char const * ptr

char * const ptr. [L.J.I.E.T].

2(17-6-2013)

6 What is Reference variable? What is its major use? Give Example. [L.J.I.E.T]. 4(17-06-2013)

7 Explain following with example w. r. to C++.

1. new operator

Explain new and delete operator.What are the advantages of new operator

Over malloc? [L.J.I.E.T].

7(17-6-2010)

8 Explain reference variables. [L.J.I.E.T]. 4 (05-06-2015)

9 Explain >> and << operators. [L.J.I.E.T]. 4 (05-06-2015)

Page 4: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 4

CHAPTER NO- 3 : C++ Functions :

TOPIC:1 Simple Function , Call and return by reference

SHORT QUESTIONS

1 Which of the following is not the member of class?

a. Static function

b. Friend function

c. Const function

d. Virtual function [L.J.I.E.T].

1

2 Which of the following concept of oops allows compiler to insert arguments in a

function call if it is not specified?

a. Call by value

b. Call by reference

c. Default arguments

d. Call by pointer [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Write the different ways of writing function prototypes. Find errors, if any in the

declaration - int mul(int a,b); [L.J.I.E.T]. 3

2 Explain keyword “this” in C++ language. What are the applications of this pointer?

[L.J.I.E.T]. 3

3 Explain static member variable and member function. [L.J.I.E.T]. 3

4 When a member function can be called const member function? [L.J.I.E.T]. 2

5 Explain static function with suitable example. [L.J.I.E.T]. 2

6 Explain the need of static function for a class. [L.J.I.E.T]. 3

7 Explain following with example w. r. to C++.

1. Static data member and static function member[L.J.I.E.T].

7(17-6-2011)

8 What do you mean by call by value and call by reference? Justify your answer

with suitable example. [L.J.I.E.T].

7 (04-01-2016)

TOPIC:2 Inline Function , Macro vs Inline Function

SHORT QUESTIONS

1 Define : Inline Function [L.J.I.E.T]. 1

2 Define : Macro [L.J.I.E.T]. 1

3 List out different types of Macro. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 When a function will be made inline? Why? How does it differ from preprocessor

macro? [L.J.I.E.T]. 3

2 Distinguish between macro definition, normal function and inline function. What are

the advantages and disadvantages of inline function? [L.J.I.E.T]. 7

3 Explain the term inline function with suitable example in brief[L.J.I.E.T]. 3

7(02-01-2015)

4 What is inline function? Explain with example. [L.J.I.E.T]. 4

(24-12-2008)

7(31-03-2010)

7 (25-06-2014)

5 What is inline function in C++? Give their merits and explain them with examples.

[L.J.I.E.T]. 7(4-1-2010)

6 What is inline function? How it is different than the macros? Write a simple C++ 7(4-1-2010)

Page 5: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 5

program which shows the difference between them. [L.J.I.E.T].

7 What is inline function? How it is different than the macros? Write a simple C++

program which shows the difference between them. [L.J.I.E.T]. 7(5-01-2011)

8 What is Inline Function? In which Situation Inline Function may not work? How does

an inline function differ from a preprocessor macro? Write program using Inline

Function to find largest of three numbers. [L.J.I.E.T].

7(17-06-2013)

9 Explain merits and demerits of inline functions. [L.J.I.E.T]. 4 (05-06-2015)

TOPIC:3 Overloading of Function , Default Argument

SHORT QUESTIONS

1 Define : Function Overloading. [L.J.I.E.T]. 1

2 Difference between Overloading and Overriding. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Explain function Overloading with appropriate examples. [L.J.I.E.T]. 3

2 Explain how default arguments can be passed to functions. [L.J.I.E.T]. 3

3 What are default arguments? Demonstrate its use with proper example[L.J.I.E.T]. 7(17-7-2011)

7(23-06-2011)

4 Define Function Overloading. Give proper example. [L.J.I.E.T]. 3(17-06-2013)

7(02-01-2015)

5 Explain default arguments. [L.J.I.E.T].

4 (05-06-2015)

TOPIC:3 Friend Function , Virtual Function

SHORT QUESTIONS

1 Which of the following cannot be friend?

a. Function

b. Class

c. Object

d. Operation function [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Explain the applications of a friend function. [L.J.I.E.T]. 7

2 Explain friend function with example. [L.J.I.E.T]. 5

(24-12-2008)

3 Explain friend function with an example. [L.J.I.E.T]. 4

(24-12-2008)

7(02-01-2015

4 What is friend function? Describe its characteristic. [L.J.I.E.T]. 5(10-06-2009)

5 What is Friend function? Write a C++ Program to show usage of Friend Function.

[L.J.I.E.T]. 7(4-1-2010)

6 What is friend function? Write simple C++ program which shows that friend function

as a bridge between classes. [L.J.I.E.T]. 7(05-01-2011)

7 Give example of friend classes/functions in C++.[L.J.I.E.T]. 4(8-09-2009)

8 What are the special characteristics of friend function write a small program which

illustrates the use of friend function. [L.J.I.E.T]. 7(31-03-2010)

9 Write the short notes on following.

. (ii) Friend Function. [L.J.I.E.T]. 4(05-01-2011)

10 Explain friend function with the help of an example.

4 (05-06-2015)

11 What is friend function? Write a program to find out sum of two private data 7 (04-01-2016)

Page 6: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 6

members x and y of two classes A and B using a common friend function.

Assume that the prototype for both the classes will be void sum (A, B); [L.J.I.E.T].

CHAPTER NO- 4 : Objects and Classes :

TOPIC:1 Basics of Object and Classes in c++, Private and Public

Members

SHORT QUESTIONS

1 Which of the following term is used for a function defined inside a class?

a. Member Variable

b. Member function

c. Class function

d. Classic function [L.J.I.E.T].

1

2 The "_____" keyword is used to create an instance of a class. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Define Friend Function. Create two classes DM and DB which store the value of

distances. DM stores distances in meters 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 a friend function to carry out the addition operation.

The object stores the results may a DM object or DB object, depending on the units in

which the results are required. The display should be in the format of feet and inches

or meters and centimeters depending on the object on display.

1 Feet = 0.3048Meter 1Meter = 3.28 Feet

1 Inch = 2.54 Centimeter 1 Centimeter = 0.3937 Inch [L.J.I.E.T].

7(17-06-2013)

2 Create a class Account. It has three data member account id, name and balance.

Define function to assign value and display value. Define function that search account

number given by the user. If account number exists, print detail of that

account. Write a program using array of object. Declare at least 5 account and print

details. [L.J.I.E.T].

7(17-06-2013)

3 Design Time class with three data members (hours, minutes, and seconds) and

initialized data members with 4 different constructors. Once value is not passed assign

data members with default value zero. Overload operator + which will do summation

of 2 time objects and return answer time object. [L.J.I.E.T].

7

4 How we can achieve following things?

cin>>employee1 [It will ask for data member input]

cout<<employee1 [It will print data members of object]

employee1 is object of employee class. [L.J.I.E.T].

7

5 Write a program which can convert Kilometer object to Meter object and Meter object

to kilometer object. [L.J.I.E.T]. 7

6 Create two classes Integer and Float that stores the int type and float type respectively.

Include default constructor, copy constructor in both the classes. Also write the

functions that support the following.

Float F1;

Integer I1;

F1 = I1 + F1; [L.J.I.E.T].

4

7 Write a C++ program that creates inventory of items by storing item_code, item name

and qty. Access the data using pointers. [L.J.I.E.T]. 7(25-06-2014)

8 Define a class complex with real and imaginary as two data member with default &

parameterized constructors, function to initialize and display data of class. It should

overload the + operator to add two complex objects. Write a complete C++ program to

7(02-01-2015)

Page 7: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 7

demonstrate use of complex class.

9 Create a class student that stores roll_no, name. Create a class test that stores marks

obtained in five subjects. Class result derived from student and test contains the total

marks and percentage obtained in test. Input and display information of a student.

7(02-01-2015)

10 Create a class ITEM with item_code, item_rate and quantity as data members. Create

an array of pointers to objects of class ITEM. Write a member function which will

calculate the amount of item. Print item_code and amount of item.

7(02-01-2015)

11 Explain pointer to objects. What is this pointer? Write a complete program to

illustrate the use of this pointer. [L.J.I.E.T]. 7(30-12-2013)

7(02-01-2015)

12 Define with examples

(1) Object (2) Macro (3) Binary file (4) Portability . [L.J.I.E.T]. 8(25-06-2014)

13 What is the difference between a structure and a class in C++? [L.J.I.E.T].

2

14 How does a class accomplish data hiding? [L.J.I.E.T].

2

15 Declare a class called item having data members item_code, item_name, cost and

discount. Derive two classes from class item, namely employee and customer. The

class employee has data members like employee_code,employee_name and

amount. The class customer has data members like customer_name and amount.

Define following functions for

- initializing data members.

- displaying the values of data members.

- computing amount to be paid for a purchased item.

Also define function main to create objects of both derived classes and to show

usage of above functions. [L.J.I.E.T].

7(05-06-2015)

16 Explain keywords protected and public. [L.J.I.E.T]. 4(05-06-2015)

17 Declare a class called book_details to represent details for a book, having data

members like title, author, edition, price and no_of_copies_available. Define

following functions:

- constructor(s)

- display to display all data members

- find_books to find and display details of all books having price less than Rs.

250

- main to create an array of book_details and to show usage of above

functions.[L.J.I.E.T].

7 (05-06-2015)

TOPIC:2 Static Data and Function Members

SHORT QUESTIONS

1 Define : Static Data Member .[L.J.I.E.T]. 1

2 Define : Static Member Function .[L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Explain following with example w. r. to C++.

1. Static data member and static function member

What is the purpose of Static? Write Characteristics of Static Data Member and

Static Member Function. Write a program that demonstrates the Static Data

Member And static member function. [L.J.I.E.T].

7(17-6-2013)

7(25-06-2014)

7(02-01-2015

2 Write down the uses of static data member and static member function with

suitable example. [L.J.I.E.T]. 7 (04-01-2015)

Page 8: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 8

TOPIC:3 Constructor and their types , Destructor

SHORT QUESTIONS

1 A constructor that accepts __________ parameters is called the default constructor.

a. One

b. Two

c. Three

d. No . [L.J.I.E.T].

1

2 What happens when a class with parameterized constructors and having no default

constructor is used in a program and we create an object that needs a zeroargument

constructor?

a.Compile-time error.

b. Preprocessing error.

c. Runtime error.

d. Runtime exception. [L.J.I.E.T].

1

3 Can a class have virtual destructor?

a. Yes

b. No

c. May be

d. None of above[L.J.I.E.T].

1

4 For automatic objects, constructors and destructors are called each time the objects

a. enter and leave scope

b. inherit parent class

c. are constructed

d. are destroyed [L.J.I.E.T].

1

5 Copy constructor must receive its arguments by __________ .

a. either pass-by-value or pass-by-reference

b. only pass-by-value

c. only pass-by-reference

d. only pass by address [L.J.I.E.T].

1

6 Which of the following gets called when an object goes out of scope?

a. Constructor

b. Destructor

c. Main

d. virtual function [L.J.I.E.T].

1

7 __________ used to make a copy of one class object from another class object of the

same class type.

a. Constructor

b. Copy constructor

c. Destructor

d. Default constructor [L.J.I.E.T].

1

8 Constructor __________ to allow different approaches of object construction.

a. cannot overloaded

b. can be overloaded

c. can be called

d. can be nested [L.J.I.E.T].

1

9 If the copy constructor receives its arguments by value, the copy constructor would

a. call one-argument constructor of the class

b. work without any problem

c. call itself recursively

d. call zero-argument constructor [L.J.I.E.T].

1

Page 9: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 9

10 Which of the following are NOT provided by the compiler by default?

a. Zero-argument Constructor

b. Destructor

c. Copy Constructor

d. Copy Destructor [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Define a class complex with real and imaginary as two data member, add

necessary constructors and member function to initialize and display data of

class. Class should overload the + operator to add two complex objects and

return the results. Invoke the statements like C3=C1+C2 in main ().[L.J.I.E.T].

7(30-12-2013)

2 Define a class Time with hours and minutes as two data members, add

necessary member functions to initialize and display data of class. Do not use

constructors in a class. Define a member function sum() which adds two Time

objects. Invoke the statements like T3.sum(T1, T2) in main ().

7(30-12-2013)

3 What is Constructor? Write the characteristics of constructor function. Define Class

named point which represents 2-D Point, i.e P(x, y). Define Default constructor to

initialize both data member value 5, Parameterized constructor to

initialize member according to value supplied by user and Copy Constructor. Define

Necessary Function and Write a program to test class Point. [L.J.I.E.T].

7(17-06-2013)

4 Explain following with example w. r. to C++.

1. Copy constructor 7(23-06-2011

5 Explain following with example w. r. to C++.

parameterized constructor [L.J.I.E.T]. 7(23-06-2011)

6 What are the characteristics of constructor? Explain how to initialize the variable

using constructor. [L.J.I.E.T]. 5

(24-12-2008)

7 Explain the usage of constructor and destructor in C++. [L.J.I.E.T]. 7 (17-03-2009)

8 What is the use of Constructor and Destructor in C++? Write a C++program to

demonstrate the use of Constructor and Destructor. [L.J.I.E.T]. 7 (4-1-2010)

9 Explain the following with proper examples.

1. Copy constructor [L.J.I.E.T]. 8(17-6-2010)

10 What is constructor function? List the at least five characteristics of constructor

function. [L.J.I.E.T]. 7(17-6-2010)

11 Write a C++ program to demonstrate copy constructor. [L.J.I.E.T]. 7 (17-03-2009)

12 What is constructor? What is destructor? Explain it with example. Also Give some of

the special properties of constructor and destructor. [L.J.I.E.T]. 5(8-09-2009)

13 What is a constructor? Which are the special characteristics of constructor

functions? What is the need of “do-nothing” implicit constructor? When the

destructor function invoked? [L.J.I.E.T].

7(30-12-2013)

14 Explain the following with proper examples.

1. Copy constructor[L.J.I.E.T]. 04(17-6-2010)

15 What is constructor function? List the at least five characteristics of constructor

function. [L.J.I.E.T]. 7(05-01-2011)

16 What are the characteristics of constructor in C++? Explain its use with example.

[L.J.I.E.T]. 7(30-11-2010)

17 What is a copy constructor? What is the difference between the following statements?

[L.J.I.E.T].

Integer I2(I1);

I2=I1; [L.J.I.E.T].

4

Page 10: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 10

18 What is the use of parameterized constructor? Define dynamic constructor. What is

the difference between following two statements if integer is a class and integer(int x,

int y) is the constructor method. integer int1 = integer(0,100);

integer int1(0,100); [L.J.I.E.T].

4

19 What are read only objects? Explain the role of constructors in creating such objects?

[L.J.I.E.T]. 4

20 What are the different types of constructors? [L.J.I.E.T].

3

7 (25-06-2014)

7(02-01-2015)

21 What are constructors and destructors? How do they differ from normal functions?

[L.J.I.E.T]. 4

7 (25-06-2014

22 Explain copy constructor and its use by giving an example. [L.J.I.E.T]. 7(05-06-2015)

23 What are the characteristics of constructor in C++? Write a program to

illustrate the use of copy constructor. [L.J.I.E.T].

7 (04-01-2016)

TOPIC:3 Operator Overloading and Type Conversion

SHORT QUESTIONS

1 Which of the following is not an operator overloaded by the C++ language?

a. pow

b. >>

c. +

d. << [L.J.I.E.T].

1

2 Which statement about operator overloading is false?

a. New operators can never be created.

b. Certain overloaded operators can change the number of arguments they takec. The

precedence of an operator cannot be changed by overloading.

d. Overloading cannot change how an operator works on built -in types. [L.J.I.E.T].

1

3 To implicitly overload the += operator:

a. Only the = operator needs to be overloaded.

b. Only the + operator needs to be overloaded.

c. The += operator cannot be overloaded implicitly.

d. Both the + and = operators need to be overloaded. [L.J.I.E.T].

1

4 For operators overloaded as non-static member functions:

a. Both binary and unary operators take one argument.

b. Neither binary nor unary operators can have arguments.

c. Binary operators can have two arguments and unary operators can have one.

d. Binary operators can have one argument, and unary operators cannot have any.

[L.J.I.E.T].

1

5 Which of the following is false?

a. Two arrays cannot be meaningfully compared with equality or relational

operators.

b. C++ ensures that you cannot “walk off” either end of an array.

c. An entire non-char array cannot be input or output at once.

d. Arrays cannot be assigned to one another (i.e., array1 = array2;). [L.J.I.E.T].

1

6 The array subscript operator [], when overloaded, cannot:

a. Take multiple values inside (e.g., [4 8]).

b. Take a float as an operand.

1

Page 11: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 11

c. Take user-defined objects as operands.

d. Be used with linked list classes. [L.J.I.E.T].

DESCRIPTIVE QUESTIONS

1 Write a C++ program that overloads + operator to add two complex numbers.

[L.J.I.E.T]. 7(25-06-2014)

2 Define Operator overloading. Create class Time that has three data members

hour, minute and second and two constructor, default constructor and

parameterized constructor to initialize data member. Write a program to add two

times by overloading operator +. [L.J.I.E.T].

7(17-06-2013)

3 Explain with example how to overload unary operators. [L.J.I.E.T]. 4

4 How type conversion from a class to basic type is performed? Which conditions

casting operator function should satisfy? Can the constructor student (int rollno,

double percentage) for class student be used to convert types?

Explain the type conversion from basic type to class type and from class type

to basic type with proper example. [L.J.I.E.T].

4

7(30-12-2013)

5 What is operator overloading? What is the difference if friend function is used in the

place of member functions for overloading binary operator? [L.J.I.E.T].

3

6 Design classes such that they support the following statements:

Rupee r1,r2; Dollar d1,d2;

d1 = r1; // converts rupee (Indian Currency) to dollar (US currency)

r2 = d2; // converts dollar (US Currency) to rupee (Indian currency)

NOTE: Assume 1 dollar = 47 Rupees. [L.J.I.E.T].

4

7 Declare a class called book having members like book_title, publisher and

author_name. Overload extractor and inserter operators ( >> and << ) for

class book. [L.J.I.E.T].

4(05-06-2015)

8

Declare a class called bird having private data members name and weight. Define

following functions :

- default constructor for reading data members from key board

- overloaded constructor with two arguments to be used for initialization of data

members.

- display function to display data members.

- overloaded member operator >= to compare weight of two bird objects,

returning false if weight of first bird object is less than that of the second & true

otherwise.

Define main to illustrate use of above functions. [L.J.I.E.T].

7(05-06-2015)

9 Is assignment operator overloaded by default? Justify your answer. When do

you overload it mandatorily? [L.J.I.E.T]. 7(05-06-2015)

10 Explain type conversion from class type to basic type and one class type

another class type with suitable example. [L.J.I.E.T]. 7 (04-01-2016)

11

What is an operator function? Write a program to overload binary + operator as

member function. [L.J.I.E.T]. 7 (04-01-2016)

CHAPTER NO- 5 : Inheritance :

TOPIC:1 Concept of Inheritance and Type Of Inheritance

SHORT QUESTIONS

1 Which allows you to create a derived class that inherits properties from more than 1

Page 12: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 12

one base class?

a. Multilevel inheritance

b. Multiple inheritance

c. Hybrid Inheritance

d. Hierarchical Inheritance[L.J.I.E.T].

2 Which feature in OOP allows reusing code?

a. Polymorphism

b. Inheritance

c. Encapsulation

d. Data hiding[L.J.I.E.T].

1

3 class derived: public base1, public base2 { } is an example of

a. Polymorphic inheritance

b. Multilevel inheritance

c. Hierarchical inheritance

d. Multiple inheritance[L.J.I.E.T].

1

4 A class defined within another class is:

a. Nested class

b. Inheritance

c. Containership

d. Encapsulation[L.J.I.E.T].

1

5 The major goal of Inheritance in c++ is:

a. to facilitate the conversion of data types.

b. to help modular programming.

c. to extend the capabilities of a class.

d. to hide the details of base class.[L.J.I.E.T].

1

6 Advantages of inheritance include

a. providing class growth through natural selection

b. facilitating class libraries

c. avoiding the rewriting of code

d. none of the above[L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 What are the different types of Inheritance? [L.J.I.E.T]. 4

7(02-01-2015)

2 Compare containership with inheritance. Also list the types of inheritance. [L.J.I.E.T].

7

3 How multiple and multilevel types of inheritance are achieved in C++? Explain with

examples. [L.J.I.E.T]. 7

4 Assume that Circle is defined using radius and Cylinder is defined using

radius and height. Write a Circle class as base class and inherit the Cylinder

class from it. Develop classes such that user can compute the area of Circle

objects and volume of Cylinder objects. Area of Circle is pie *radius*radius,

while volume of Cylinder is pie*(radius * radius)*height. [L.J.I.E.T].

7(30-12-2013)

5 Consider a class network as shown in figure given below. The class Employee

derives 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.

7(30-12-2013)

Page 13: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 13

Person(Name,code)

Account(Pay) Admin(Experience)

Employee(Name,code,Pay,Experience)

[L.J.I.E.T].

6 What are the different forms of Inheritance? Explain each form with example. 5(10-6-2009)

7 What does inheritance mean in “C++”. What are different forms of inheritance?

Explain with syntax. [L.J.I.E.T].

7(2-01-2010)

8 Write the short notes on following.

. (i) Inheritance [L.J.I.E.T].

4(05-01-2011)

9 Define Inheritance. Write the types of Inheritance. Explain Inheritance with example.

Consider Example with respect to print result of Student and Student Details.

[L.J.I.E.T].

7(17-6-2013)

10 Explain various forms of inheritance with suitable diagrammatic illustrations.

[L.J.I.E.T].

7(30-12-2013)

11 Describe multi-level and multiple inheritances. [L.J.I.E.T]. 4 (05-06-2015)

12 Consider the following class structure as shown in the figure. The class Result

derives information from the classes Internal, University and External

respectively. The Internal and External classes access information from the

7 (04-01-2016)

Student class. Define all five classes and write a suitable program to create

anddisplay the information contained in Result object. [L.J.I.E.T].

13 What is inheritance? Why do we use of protected specifier for base class data 7 (04-01-2016)

Page 14: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 14

members in inheritance? Explain hybrid inheritance with example. [L.J.I.E.T].

TOPIC:2 Protected Member , Overriding and Virtual Base Class

SHORT QUESTIONS

1 A class hierarchy (inheritance)a. shows the same relationships as an organization chart

b. describes "has a" relationships

c. describes "is a kind of" relationships

d. shows the same relationships as a family tree[L.J.I.E.T].

1

2 A pure virtual function is a function that:

a. has no body

b. returns nothing

c. is used in a base class

d. takes no argument[L.J.I.E.T].

1

3 ____________ is a relationship.

a. Polymorphism

b. Inheritance

c. Overloading

d. None of these option[L.J.I.E.T].

1

4 Can two classes contain member functions with the same name?

a. No

b. Yes, but only if the two classes have the same name.

c. Yes, but only if the main program does not declare both kinds

d. Yes, this is always allowed. [L.J.I.E.T].

1

5 A derived class ____________.

a. Inherits data members and member functions from base class.

b. Inherits constructors and destructors.

c. Object can access protected members with the dot operator.

d. None of the above. [L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Explain Virtual Base Class with example. [L.J.I.E.T]. 7

2 Explain the need of Virtual base class with example. [L.J.I.E.T]. 3

3 What is virtual destructor? Explain its need. Can we have virtual constructors? Why?

[L.J.I.E.T]. 7

4 What is a virtual function? When do we make a virtual function “pure”? What is a

function template? [L.J.I.E.T]. 3

5 How is polymorphism achieved at (i) compile time

(ii) Run time? [L.J.I.E.T]. 3(17-6-2013)

7(25-06-2014)

6 What is an abstract class? What is virtual base class? [L.J.I.E.T]. 4

7 Explain polymorphism. How do you achieve run time polymorphism in

C++?[L.J.I.E.T].

7

8 Explain different access specifiers with suitable examples[L.J.I.E.T]. 5

9 Explain the following terms in brief with suitable examples

(i) Pure Virtual Functions

(ii) Virtual destructors

(iii) Run Type identification

Define and Discuss Pure Virtual Function. [L.J.I.E.T].

7

2(17-6-2013)

10 Distinguish between compile time polymorphism and Run Time Polymorphism with

suitable examples. [L.J.I.E.T]. 3

11 Write short note on Polymorphism. [L.J.I.E.T]. 7(17-03-2009)

Page 15: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 15

4(05-01-2011)

CHAPTER NO- 6 : Polymorphism :

TOPIC:1 Pointer in c++, Pointer and Object , This Pointer

SHORT QUESTIONS

1 Define ‘address of’ operator. .[L.J.I.E.T]. 1

2 ______________ is a derived data type that refers to another data variable by storing

the

variable’s memory address rather than data.

a. Pointers

b. Polymorphism

c. Structure

d. Inheritance..[L.J.I.E.T].

1

3 A pointer can be incremented and decremented by

a. ++

b. –

c. A and B

d. A only.[L.J.I.E.T].

1

4 A ___________ pointer refers to an object that is currently invokes a member

function.

a. this

b. these

c. that

d. none of above .[L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Explain needs and usage of this pointer.[L.J.I.E.T]. 4(05-06-2015)

TOPIC:2 Virtual and Pure Virtual Function , Implementing

Polymorphism

SHORT QUESTIONS

1 What is compile time polymorphism? .[L.J.I.E.T]. 1

2 What is dynamic binding? .[L.J.I.E.T]. 1

3 ____________ means ‘one name, multiple forms’.

a. Polymorphism

b. Inheritance

c. Encapsulation

d. None of above.[L.J.I.E.T].

1

4 Concept of polymorphism is implemented using

a. Function overloading

b. Operator overloading

c. A and B

d. A only.[L.J.I.E.T].

1

5 An object is bound to its function call at compile time known aa. Early binding

b. Compile time polymorphism

c. Static binding

d. All of above.[L.J.I.E.T].

1

6 We can have virtual destructor but not have constructor. 1

Page 16: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 16

a. True

b. False

c. May be

d. None of above.[L.J.I.E.T].

7 A virtual function, equated to zero is called _____________

a. Pure virtual function

b. Virtual function

c. Friend function

d. None of above.[L.J.I.E.T].

1

DESCRIPTIVE QUESTIONS

1 Explain Runtime polymorphism. Explain and demonstrate, how virtual

function to achieve runtime polymorphism? [L.J.I.E.T].

7(30-12-2013)

2 Explain the following terms in brief with suitable examples

(iv) Pure Virtual Functions

(v) Virtual destructors

(vi) Run Type identification

Define and Discuss Pure Virtual Function. [L.J.I.E.T].

7

2(17-6-2013)

3 Distinguish between compile time polymorphism and Run Time Polymorphism with

suitable examples. [L.J.I.E.T]. 3

4 Write short note on Polymorphism. [L.J.I.E.T]. 7(17-03-2009)

4(05-01-2011)

5 Declare a class called logic_gate to represent logic gates. The class has three data

members - input1, input2 and input3 to represent three inputs to the logic gate.

The class also has a virtual function member called get_gate_output. Derive two

classes from the base class logic_gate, namely, and_gate and or_gate to represent

‘logical and gate’ and ‘logical or gate’ respectively. Define function

get_gate_output in both of these classes to get the output of the gate. Show use

of above classes and functions to demonstrate dynamic polymorphism in function

main. [L.J.I.E.T].

7 (05-06-2015)

6 Explain two usage of keyword virtual. [L.J.I.E.T]. 4 (05-06-2015)

7 What is polymorphism? How is it achieved in C++? Explain with suitable

example. [L.J.I.E.T]. 7 (04-01-2016)

CHAPTER NO- 7 : I/O and File Management :

TOPIC:1 Concept of Streams,cin and cout Objects, c++ Stream

Classes, Unformated and Formated I/O

SHORT QUESTIONS

1 ___________ class provides the basic support for formatted and unformatted I/O

operations.

a. ios

b. istream

c. streambuf

d. ostream

1

2 The class ___________ provides the facilities for formatted and unformatted input.

a. istream

b. istream_withassign

c. iostream

1

Page 17: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 17

d. streambuf

3 The class ___________ provides the facilities for formatted and unformatted output.

a.ostream

b. ostream_withassign

c. iostream_withassign

d.streambuf

1

DESCRIPTIVE QUESTIONS

1 (ii)Explain flags ios::binary and ios::ate.[L.J.I.E.T]. 3(05-06-2015)

TOPIC:2 Manipulator ,File Streams and Files

SHORT QUESTIONS

1 _________ is a sequence of bytes.

a. Stream

b. Input stream

c. Output stream

d. None of above

1

2 The source stream that provides data to the program is called

a. Stream

b. Input stream

c. Output stream

d. None of above

1

3 The destination stream that receives output from the program is called

a. Stream

b. Input stream

c. Output stream

d. None of above

1

4 The data in the input stream can come from the

a. Keyboard

b. Monitor

c. A and b

d. None of above

1

5 Which class is the base class for rest of the classes in stream classes?

a. ios

b. istream

c. streambuf

d. none of above

1

6 The header file ___________ provides a set of manipulator functions to manipulate

output formats.

a. stdio

b. iomanip

c. A and B

d. None of above

1

DESCRIPTIVE QUESTIONS

1 (i) Explain try, catch and throw. Give one simple example.

(ii) Explain tellg and seekp functions. [L.J.I.E.T]. 7 (05-06-2015)

2 Write a program that opens two text files for reading data. It creates a third file 7(05-06-2015)

Page 18: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 18

that contains the text of first file and then that of second file (text of second file to

be appended after text of the first file, to produce the third file). [L.J.I.E.T].

3 Explain manipulators. [L.J.I.E.T]. 3(05-06-2015)

4 Explain various constructors of ofstream.. [L.J.I.E.T]. 4(05-06-2015

5 Explain various file mode parameters in C++. Write a program to copy the

contents of a source file student1.txt to a destination file student2.txt

character by character..[L.J.I.E.T]

7(04-01-2016)

6 What is a stream? Describe various stream classes for console I/O operations in

C++...[L.J.I.E.T] 7(04-01-2016)

CHAPTER NO- 8 : Template , Exception and STL :

TOPIC:1 Template,Function Template and Class Template

SHORT QUESTIONS

1 Define :- Template [L.J.I.E.T]. 1

2 Difference between Function Template and Class Template. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Why functions like terminate or unexpected exists when abort() and exit () functions

are available? [L.J.I.E.T].

7

2 What are the problems of using macros? How does template helps in this? Explain.

[L.J.I.E.T].

7

3 What is the difference between overloaded functions and function templates? Justify –

Is this a legal statement –

Template<class T1, class T2>

Class Test

{

};[L.J.I.E.T].

3

4 Explain Function Template Instantiation process with example of Generic Bubble Sort

Function Template. [L.J.I.E.T]. 7

5 Explain Class Template with Generic Stack Class example also describe the usage of

Stack class for inserting student records. [L.J.I.E.T]. 7

2(25-06-2014)

6 What is Generic Programming? How it is implemented in C++.Write General

format of class templates and function Template. Write program to swap

Number using Function Template. Function prototype is given below:

void swap(int, int , float , float )

Swap two integer number and swap two float number..[L.J.I.E.T].

7(17-6-2013)

7 Explain with the help of an example why templates are used in

programming?.[L.J.I.E.T]. 7(30-12-2013)

8 Declare a template class called exam having an array of generic type as a data

member, named elements[10]. Define following generic (template) member

functions:

- sort to arrange elements in ascending order

- find_max to find and return maximum from the array

Define main to illustrate usage of these functions to process two different types of

data. .[L.J.I.E.T].

7(05-06-2015)

Page 19: Subject Name: Object Oriented Programming with C++ Subject ...

L.J. Institute of Engineering & Technology Semester: IV (2016)

OOCP(2140705) 2016 Page 19

9 What is the purpose of using template in C++? Explain template function and

template class with example. .[L.J.I.E.T] 7(04-01-2016)

TOPIC:2 Exception , With using Try..Catch

SHORT QUESTIONS

1 Define :- Exception. [L.J.I.E.T]. 1

2 List out the blocks used in Exception handlimg. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Explain under what circumstances the following statements would be used?

(i) throw;

(ii) catch(…) .[L.J.I.E.T].

4

2 What is an exception? When does a program throw an exception ? What should be

placed inside a try block? What should be placed inside a catch block? .[L.J.I.E.T]. 4

3 How templates function if Overloaded? Explain. .[L.J.I.E.T]. 3

4 What do you mean by exception ? Describe the role of keywords try, catch and throw

in exception handling. .[L.J.I.E.T]. 7

4(25-06-2014)

7(02-01-2015)

5 What do you mean by Terminate and Unexpected functions? Explain. .[L.J.I.E.T]. 3

6 What are major drawbacks of exception handling approach? Explain. .[L.J.I.E.T]. 2

7 Explain the exception class. .[L.J.I.E.T]. 2

8 What is Exception? Explain Exception HandlingMechanism.Write a program

that demonstrates use of multiple catch. Add at least three catch block in your

Program. .[L.J.I.E.T].

7(17-6-2013)

9 What is an exception? What are the advantages of using exception handling in a

program? Illustrate C++ exception handling mechanism. .[L.J.I.E.T]. 7(30-12-2013)

10 By giving an example, illustrate use and working of nested try blocks and re throwing

of an exception.[L.J.I.E.T] 7(05-06-2015)

11 Explain catch all exception and multiple catch exception with example. .[L.J.I.E.T] 7(04-01-2016)

12 Explain the mechanism of keywords try, throw and catch to handle Exceptions

in C++. Explain with an example like “division by zero” situation. .[L.J.I.E.T] 7(04-01-2016)

TOPIC:3 Standard Template Library

SHORT QUESTIONS

1 List out the components of STL. [L.J.I.E.T]. 1

DESCRIPTIVE QUESTIONS

1 Explain STL with its core components. [L.J.I.E.T]. 7(02-01-2015)