Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C++ - QUESTIONS : PART 10

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.
SHOW ANSWER

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().
SHOW ANSWER

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.
SHOW ANSWER

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

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.
SHOW ANSWER

 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.
SHOW ANSWER

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.
SHOW ANSWER

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.
SHOW ANSWER

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

Protected

Public

Private

Friend
SHOW ANSWER

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.
SHOW ANSWER

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

Default

Break

Protected

Asm
SHOW ANSWER

Which of the following can access private data members or member functions of a class?

Any function in the program.

All global functions in the program.

Any member function of that class.

Only public member functions of that class.
SHOW ANSWER

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

Public

Inherited

Static

Friend
SHOW ANSWER

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

Friend Functions

Object

Member Functions

Member Variables
SHOW ANSWER

Constructor is executed when _____.

an object is created

an object is used

a class is declared

an object goes out of scope.
SHOW ANSWER

 Which of the following statements about virtual base classes is correct?

It is used to provide multiple inheritance.

It is used to avoid multiple copies of base class in derived class.

It is used to allow multiple copies of base class in a derived class.

It allows private members of the base class to be inherited in the derived class.
SHOW ANSWER

How many objects can be created from an abstract class?
 

Zero

One

Two

As many as we want
SHOW ANSWER

What does the class definitions in following code represent?
class Bike
{
    Engine objEng;
};
class Engine
{
    float CC;
};

kind of relationship

has a relationship

Inheritance

Both A and B
SHOW ANSWER

Which of the following statements is correct when a class is inherited privately?

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 private members of derived class.

Public members of the base class become public members of derived class.
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in