closepop
closepop

Would you like to submit the test?


C++ :

Objects and Classes




1.
What happens when we try to compile the class definition in following code snippet?

class Birds {};
class Peacock : protected Birds {};

It will not compile because class body of Birds is not defined.
It will not compile because class body of Peacock is not defined.
It will not compile because a class cannot be protectedly inherited from other class.
It will compile succesfully.




2.
Which of the following statements is incorrect?

Friend keyword can be used in the class to allow access to another class.
Friend keyword can be used for a function in the public section of a class.
Friend keyword can be used for a function in the private section of a class.
Friend keyword can be used on main().




3.
Which of the following statement is correct regarding destructor of base class?

Destructor of base class should always be static.
Destructor of base class should always be virtual.
Destructor of base class should not be virtual.
Destructor of base class should always be private.




4.
Which of the following two entities (reading from Left to Right) can be connected by the dot operator?

A class member and a class object.
A class object and a class.
A class and a member of that class.
A class object and a member of that class.




5.
How can we make a class abstract?

By making all member functions constant.
By making at least one member function as pure virtual function.
By declaring it abstract using the static keyword.
By declaring it abstract using the virtual keyword.




6.
Which of the following statements is correct when a class is inherited publicly?

Public members of the base class become protected members of derived class.
Public members of the base class become private members of derived class.
Private members of the base class become protected members of derived class
Public members of the base class become public members of derived class.




7.
Which of the following statements is correct about the constructors and destructors?

Destructors can take arguments but constructors cannot.
Constructors can take arguments but destructors cannot.
Destructors can be overloaded but constructors cannot be overloaded
Constructors and destructors can both return a value.




8.
Which of the following access specifies is used in a class definition by default?

Protected
Public
Private
Friend




9.
Which of the following statement is correct with respect to the use of friend keyword inside a class?

A private data member can be declared as a friend.
A class may be declared as a friend.
An object may be declared as a friend.
We can use friend keyword as a class name.




10.
Which of the following keywords is used to control access to a class member?

Default
Break
Protected
Asm




11.
Which of the following type of data member can be shared by all instances of its class?

Public
Inherited
Static
Friend




12.
Which of the following also known as an instance of a class?

Friend Functions
Object
Member Functions
Member Variables




13.
Constructor is executed when _____.

an object is created
an object is used
a class is declared
an object goes out of scope.




14.
How many objects can be created from an abstract class

Zero
One
Two
As many as we want




15.
Which of the following statements is correct?

Data items in a class must be private.
Both data and functions can be either private or public.
Member functions of a class must be private.
Constructor of a class cannot be private.




16.
Which of the following can be overloaded?

Object
Functions
Operators
Both B and C




17.
Which of the following means "The use of an object of one class in definition of another class"?

Encapsulation
Inheritance
Composition
Abstraction










FreshersLive - No.1 Job site in India. Here you can find latest 2016 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.


FreshersLive - No.1 Job site in India. Here you can find latest 2016 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.