Oopsqbanksem 3
Oopsqbanksem 3
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?
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?
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?