0% found this document useful (0 votes)
95 views5 pages

Oopsqbanksem 3

This document contains a question bank on various topics related to classes and objects in C++ including characteristics of object oriented programming, classes, constructors and destructors, friend functions, pointers and virtual functions, inheritance, polymorphism and operator overloading, memory allocation and deallocation, templates, and exception handling. There are a total of 65 multiple choice and descriptive questions covering these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views5 pages

Oopsqbanksem 3

This document contains a question bank on various topics related to classes and objects in C++ including characteristics of object oriented programming, classes, constructors and destructors, friend functions, pointers and virtual functions, inheritance, polymorphism and operator overloading, memory allocation and deallocation, templates, and exception handling. There are a total of 65 multiple choice and descriptive questions covering these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

QUESTION BANK

Classes and objects


Q1.What are the various characteristics of Object oriented programming techniques ?
Q2.What is a class ? How does it accomplish data hiding?
Q3.How do structure of C and C++ differ ?
Q4.Diifferentiate between private,public and protected?
Q5.Discuss the significance of scope resolution operator(:: ) in C++.
Q6.Compare object oriented programming with procedural programming?
Q7.What are the differences between objects and classes ?Discuss instantiation of
objects?
Q8.Distinguish between Object and Class ?
Q9.Explain with the help of suitable example how data abstraction and data
encapsulation takes place?
Q10. What is difference between a pointer and a reference?

Constructor and Destructor


Q11What is the difference between a constructor and a simple member function of a
class? When is a constructor member function invoked in a class?
Q12. What is constructor overloading explain with example?
Q13.What is default Constructor ? How is it different from constructor with default
values?

Q14.Create a class ,which keeps track of number of instances of this class.Using Static
data members ,constructor and destructor to maintain updating information about active
objects.
Q15. .Give an Illustration of copy constructor , multiple constructs ,dynamic constructor
in a class.
Q16.What is a destructor function ? What is its use ? How many times is the destructor
invoked?What happens if a destrucor is not given in a class?
Q17.Write a program to read five real numbers and print average using a static member
class .Use parameterized constructor for entering the numbers.
Q18.Distinguish between the following two statements:
Item I1 (I2);
Item I2 = I1;
Where I1 and I2 are objects of class Item.
Q19.Create a class for manipulating coordinates in Polar coordinate System .Represent
points as objects .The class Polar must include data members radius and theta .Member
functions to add ,subtract and to find angle are to be included in the class.
Q20.What is an empty class? Can instances of empty class be created?

Friend Function
Q21. What is a friend? Do friends violate encapsulation?
Q22 .Give some advantages and disadvantages of using Friend function?
Q23.State True or false:Friend functions have access to only public members of a class?
Q24. Illustrate with an example how can a common friend function to two different
classes be declared?

Q25.Discuss the relation of a friend function with public and protected data members of
a class?

Pointers and Virtual Functions


Q25.What is Dangling pointer?
Q26. Explain ,with an example how an array of objects is created using pointers?
Q27.What is significance of THIS pointer and how is it used?
Q28.What is Auto pointer?
Q29.What are pure virtual functions? How do they differ from normal virtual function?
Q30.What are virtual destrucors? How do they differ from normal destructors?
Q31.What is a smart pointer?
Q32.What is the difference between const char *myPointer and char *const myPointer?
Q33.What is Overriding?
Q34.How are virtual functions implemented?

Inheritance
Q35.What is inheritance in C++?
Q36.Explain the need of inheritance in C++ using suitable examples?
Q37.What is visibility mode? What are the different inheritance visibility modes
supported by C++.
Q38.With an example explin what are the different types of inheritance?
Q39.In what order are the class constructors called when a derived class object is
created?
Q40.What is containership or delegation? How does it differ from inheritance?

Q41.Describe how an object of a class that contains objects of other classes is created?
Q42. What is an abstract class?

Polymorphism and Operator overloading


Q43.What is Polymorphism?
Q44.What is overloading?
Q45.Name the operators which cannot be overloaded?
Q46.What are the benefits of operator overloading?
Q47.Design a program to input two complex numbers and add them with + using
operator overloading?
Q48.What is the difference between assignment operator and arithmetic assignment
operator overloading?
Q49.Discuss the benefits of constructor overloading? What are the similarities and
differences between construcot and function overloading?
Q50.What are the limitations of overloading unary increment/decrement operator?How
are they overcome?
Q51.Why is friend function not allowed to access members of a class directly although its
body can appear within the class body?
Q52. Define two classes Polar and Rectangle to represent points in the polar and
rectangle systems. Use conversion routines to convert from one system to the other.

Memory Allocation and Deallocation


Q53.What is the difference between new/delete and malloc/free?

Q54.What s difference between new and malloc?


Q55.What is memory alignment?
Q56.Give the method to allocate multidimensional arrays using new?
Q57.Can realloc() be used on pointers allocated by new?

Templates
Q58.What is Generic programming? How is it implemented in C++?
Q59.Distinguish between overloaded functions and function templates?
Q60.What are class templates? Create a template for an array class?
Q61.When and how does C++ compiler generate an actual function definition from a
template?
Q62.What is function template? Write a function template for finding largest number in a
given array. The array parameters must be of generic data type.

Exception Handling
Q63.What is exception handling ? Explain try, throw and catch using an example?
Q64.What happens when a function throws an exception that was not specified by an
exception specification for this function?
Q65.What are the advantages of using exception handling mechanism in a program?

You might also like