C++ MCQ’s- Part-3

((MARKS)) (1/2/3…)

1

((QUESTION))

 If the derived class is struct, then default visibility mode is _______ .

((OPTION_A))

public

((OPTION_B))

protected

((OPTION_C))

private

((OPTION_D))

struct can’t inherit class

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

If base class has constructor with arguments, then it is ________________ for the derived class to have constructor and pass the arguments to base class constructor.

((OPTION_A))

Optional

((OPTION_B))

Mandatory

((OPTION_C))

Compiler dependent

((OPTION_D))

Error

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

n case of inheritance where both base and derived class are having constructor and destructor, then which if the following are true ?


1. Constructors are executed in their order of derivation
2. Constructors are executed in reverse order of derivation
3. Destructors are executed in their order of derivation
4. Destructors are executed in reverse order of derivation

((OPTION_A))

Only 2 ,4

((OPTION_B))

Only 1 , 3

((OPTION_C))

Only 1 , 4

((OPTION_D))

Only 2, 3

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

When a child class inherits traits from more than one parent class, this type of inheritance is called _______________ inheritance.

((OPTION_A))

Hierarchical

((OPTION_B))

Hybrid

((OPTION_C))

Multilevel

((OPTION_D))

Multiple

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

What is the difference between protected and private access specifiers in inheritance?

((OPTION_A))

private member is not inheritable and not accessible in derived class.

((OPTION_B))

protected member is inheritable and also accessible in derived class.

((OPTION_C))

Both are inheritable but private is accessible in the derived class.

((OPTION_D))

Both are inheritable but protected is not accessible in the derived class.

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

When a base class is privately inherited by the derived class, then_____________ .

((OPTION_A))

protected members of the base class become private members of derived class

((OPTION_B))

public members of the base class become private members of derived class

((OPTION_C))

both a and b

((OPTION_D))

only b

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The derivation of Child class from Base class is indicated by ____ symbol.

((OPTION_A))

::

((OPTION_B))

:

((OPTION_C))

;

((OPTION_D))

|

((CORRECT_CHOICE)) (A/B/C/D)

b

((MARKS)) (1/2/3…)

1

((QUESTION))

During a class inheritance in CPP, if the visibility mode or mode of derivation is not provided, then by default visibility mode is ___________.

((OPTION_A))

public

((OPTION_B))

protected

((OPTION_C))

private

((OPTION_D))

Friend

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

When base class is derived in protected mode, then_____________ .


1. public members of base class become private members of derived class.
2. public members of base class become protected members of derived class.
3. public members of base class become public members of derived class.
4. protected members of base class become protected members of derived class.
5. protected members of base class become private members of derived class.
6. protected members of base class become public members of derived class.

((OPTION_A))

Only 1, 5

((OPTION_B))

Only 1, 6

((OPTION_C))

Only 2, 6

((OPTION_D))

Only 2, 4

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

class X, class Y and class Z are derived from class BASE. This is ______ inheritance.

((OPTION_A))

Multiple

((OPTION_B))

Multilevel

((OPTION_C))

Hierarchical

((OPTION_D))

Single

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Reusability of the code can be achieved in CPP through ______ .

((OPTION_A))

Polymorphism

((OPTION_B))

Encapsulation

((OPTION_C))

Inheritance

((OPTION_D))

Both a and c

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

What is meant by multiple inheritance?

((OPTION_A))

Deriving a base class from derived class

((OPTION_B))

Deriving a derived class from base class

((OPTION_C))

Deriving a derived class from more than one base class

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which symbol is used to create multiple inheritance?

((OPTION_A))

Dot

((OPTION_B))

Comma

((OPTION_C))

Dollar

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following advantages we lose by using multiple inheritance?

((OPTION_A))

Dynamic binding

((OPTION_B))

Polymorphism

((OPTION_C))

Both a & b

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is false with respect to inheritance?

((OPTION_A))

When a base class is privately inherited,public members of the base class become private members of the derived class

((OPTION_B))

When a base class is publicly inherited,public members of the base class becomes public members of derived class

((OPTION_C))

When a base class is privately inherited,a private member of base class becomes private member of derived class

((OPTION_D))

When a base class is publicly inherited protected members of base class becomes protected members of derived class

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is/are false

((OPTION_A))

Inheritance is deriving new class from existing class

((OPTION_B))

In an inheritance, all data and function members of base class are derived by derived class

((OPTION_C))

We can specify which data and function members of base class will be inherited by derived class

((OPTION_D))

We can add new functions to derived class without recompiling the base class

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

A base class will offer

((OPTION_A))

offer more specific objects than its derived classes

((OPTION_B))

correspond to something in the rest world

((OPTION_C))

behave badly when the chops are down

((OPTION_D))

be a generalized version of its derived classes

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

If a base class member access is public, and an inherited class accesses specifier is private, which of the following statement is true ?

((OPTION_A))

The base class member can be accessed by derived class objects

((OPTION_B))

The base class members cannot be accessed by the derived class members

((OPTION_C))

The derived class members can be accessed by the base class objects

((OPTION_D))

None of above

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Choose most appropriate statement

((OPTION_A))

An abstract base class can have pure virtual destructor

((OPTION_B))

An abstract base class can have only virtual destructor

((OPTION_C))

An abstract base class can have non virtual destructor

((OPTION_D))

An abstract base class cannot have destructor

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

The conversion from basic data to class type can be done by …….

((OPTION_A))

Writing constructor

((OPTION_B))

Is not possible

((OPTION_C))

overloaded casting operator

((OPTION_D))

object of a class

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

When a base class pointer points to derived class object?

((OPTION_A))

It can access only base class members

((OPTION_B))

It can access only derived class members

((OPTION_C))

Both base class & derived class members

((OPTION_D))

None

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

what is Hybrid Inheritance?

((OPTION_A))

multiple inheritance

((OPTION_B))

multilevel inheritance

((OPTION_C))

multipath inheritance

((OPTION_D))

combination of a and b

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which design patterns benefit from the multiple inheritance?

((OPTION_A))

Adapter and observer pattern

((OPTION_B))

Code pattern

((OPTION_C))

Glue pattern

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

While overloading binary operators using member function, it requires ___ argument/s.

((OPTION_A))

Zero

((OPTION_B))

One

((OPTION_C))

Two

((OPTION_D))

Three

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

 In case of operator overloading, operator function must be ______ .


1. Static member functions
2. Non- static member functions
3. Friend Functions

((OPTION_A))

Only 2

((OPTION_B))

Only 1, 3

((OPTION_C))

Only 2 , 3

((OPTION_D))

All 1 , 2, 3

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

 Scope resolution operator is used______ .

((OPTION_A))

to resolve the scope of global variables only

((OPTION_B))

to resolve the scope of functions of the classes only

((OPTION_C))

to resolve scope of global variables as well as functions of the classes

((OPTION_D))

None of these

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

An operator function is created using _____________ keyword.

((OPTION_A))

iterator

((OPTION_B))

allocator

((OPTION_C))

constructor

((OPTION_D))

operator

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Using friend operator function, following perfect set of operators may not be overloaded.

((OPTION_A))

= , ( ) , [ ] , ->

((OPTION_B))

<<, = = , [ ] , >>

((OPTION_C))

?, = , ( ) , ++

((OPTION_D))

None of these

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

When overloading unary operators using Friend function, it requires_____ argument/s.

((OPTION_A))

Zero

((OPTION_B))

One

((OPTION_C))

Two

((OPTION_D))

None of these.

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

 In case of binary operator overloading with member function, which of following statement should be taken into consideration?

((OPTION_A))

Right hand operand must be object.

((OPTION_B))

Left hand operand must be object.

((OPTION_C))

Both the operands must be objects.

((OPTION_D))

All of these should be considered.

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is the perfect set of operators that can’t be overloaded in CPP ?

((OPTION_A))

+=, ?, :: , >>

((OPTION_B))

>>, <<, ?, *, sizeof()

((OPTION_C))

:: , . , .* , ?:

((OPTION_D))

:: , ->, * , new, delete

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

How can we restrict dynamic allocation of objects of a class using new?

((OPTION_A))

By overloading new operator

((OPTION_B))

By making an empty private new operator.

((OPTION_C))

By making an empty private new and new[] operators

((OPTION_D))

By overloading new operator and new[] operators

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following operators are overloaded by default by the compiler in every user defined classes even if user has not written?

1) Comparison Operator ( == )

2) Assignment Operator ( = )

((OPTION_A))

Both 1 and 2

((OPTION_B))

Only 1

((OPTION_C))

Only 2

((OPTION_D))

None of the two

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

We can overload which of the following C++ operators.

((OPTION_A))

Arithmetic operator (+, -, *, /)

((OPTION_B))

Class Member Access Operators (., .*)

((OPTION_C))

Size operator(sizeof)

((OPTION_D))

Conditional operator(?:)

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Operator overloading is also called …………….. polymorphism.

((OPTION_A))

run time

((OPTION_B))

initial time

((OPTION_C))

compile time

((OPTION_D))

completion time

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is the correct order involves in the process of operator overloading.
i) Define the operator function to implement the required operations.
ii) Create a class that defines the data type that is to be used in the overloading operation.
iii) Declare the operator function op() in the public part of the class.

((OPTION_A))

1-i, 2-ii, 3-iii

((OPTION_B))

1-ii, 2-iii, 3-i

((OPTION_C))

1-ii, 2-i, 2-iii

((OPTION_D))

1-iii, 2-ii, 3-i

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

State whether the following statements are True or False for overloading operators.
i) Only existing operators can be overloaded.
ii) We can change the basic meaning of an operator

((OPTION_A))

True, True

((OPTION_B))

True, False

((OPTION_C))

False, True

((OPTION_D))

False, False

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

We cannot use friend functions to overload which of the following operators.
i) membership operator(.)    ii) Assignment operator(=)
iii) class member access operator(_>)  iv) conditional operator(?:)

((OPTION_A))

i and ii only

((OPTION_B))

ii and iii only

((OPTION_C))

iii and iv only

((OPTION_D))

i and iv only

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

…………… overloaded by means of a member function, take no explicit arguments and return no explicit values.

((OPTION_A))

Unary operators

((OPTION_B))

Binary operators

((OPTION_C))

Arithmetic operators

((OPTION_D))

Function operator

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

……………. overloaded through a member function take one explicit argument and those which are overloaded through a friend function take two explicit arguments.

((OPTION_A))

Unary operators

((OPTION_B))

Binary operators

((OPTION_C))

Arithmetic operators

((OPTION_D))

Function operator

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

When using ………………., overloaded through a member function, the left hand operand must be an object of the relevant class.

((OPTION_A))

Unary operators

((OPTION_B))

Binary operators

((OPTION_C))

Arithmetic operators

((OPTION_D))

Function operator

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Operator overloading is done with the help of a special function called ……………, which describes the special task of an operator.

((OPTION_A))

overloading function

((OPTION_B))

special task function

((OPTION_C))

detail function

((OPTION_D))

operator function

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

The casting operator function should satisfy which of the following conditions.
i) It must be a class member    ii) It must not specify return type
iii) It must not have any arguments

((OPTION_A))

i and ii only

((OPTION_B))

ii and iii only

((OPTION_C))

i, iii only

((OPTION_D))

All i, ii and iii

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Operator overloading provides a flexible option for the creation of new …………….. for most of the C++ operations.

((OPTION_A))

class

((OPTION_B))

function

((OPTION_C))

object

((OPTION_D))

definitions

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Overloading the function operator

((OPTION_A))

requires a class with an overloaded operator.

((OPTION_B))

requires a class with an overloaded [ ] operator.

((OPTION_C))

allows you to create objects that act syntactically like functions

((OPTION_D))

usually make use of a constructor that takes arguments.

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Mechanism of deriving a class from another derived class is known as____

((OPTION_A))

Polymorphism

((OPTION_B))

Single Inheritance

((OPTION_C))

Multilevel Inheritance

((OPTION_D))

Message Passing

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The major goal of inheritance in c++ is:

((OPTION_A))

To facilitate the conversion of data types.

((OPTION_B))

To help modular programming.

((OPTION_C))

To extend the capabilities of a class.

((OPTION_D))

To hide the details of base class.

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

What is the return type of the conversion operator?

((OPTION_A))

void

((OPTION_B))

int

((OPTION_C))

float

((OPTION_D))

no return type

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Why we use the “dynamic_cast” type conversion?

((OPTION_A))

result of the type conversion is a valid

((OPTION_B))

to be used in low memory

((OPTION_C))

result of the type conversion is a invalid

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

How many parameters does a conversion operator may take?

((OPTION_A))

0

((OPTION_B))

1

((OPTION_C))

2

((OPTION_D))

as many as possible

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

How many types are there in user defined conversion?

((OPTION_A))

1

((OPTION_B))

2

((OPTION_C))

3

((OPTION_D))

4

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Pick out the correct syntax of operator conversion.

((OPTION_A))

Operatorfloat()const

((OPTION_B))

operator float()

((OPTION_C))

operator const

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

How to create a dynamic array of pointers (to integers) of size 10 using new in C++?

((OPTION_A))

int *arr = new int *[10];

((OPTION_B))

int **arr = new int *[10];

((OPTION_C))

int *arr = new int [10];

((OPTION_D))

Not Possible

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is true about new when compared with malloc.

  1. new is an operator, malloc is a function

  2. new calls constructor, malloc doesn’t

3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type.

((OPTION_A))

1 and 3

((OPTION_B))

2 and 3

((OPTION_C))

1 and 2

((OPTION_D))

All 1, 2 and 3

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following type of class allows only one object of it to be created?

((OPTION_A))

Virtual class

((OPTION_B))

Abstract class

((OPTION_C))

Singleton class

((OPTION_D))

Friend class

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

2.Which of the following is not a type of constructor?

((OPTION_A))

Copy constructor

((OPTION_B))

Friend constructor

((OPTION_C))

Default constructor

((OPTION_D))

Parameterized constructor

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following statements is correct?

((OPTION_A))

Base class pointer cannot point to derived class.

((OPTION_B))

Derived class pointer cannot point to base class.

((OPTION_C))

Pointer to derived class cannot be created.

((OPTION_D))

Pointer to base class cannot be created.

((CORRECT_CHOICE)) (A/B/C/D)

B

((CORRECT_CHOICE)) (A/B/C/D)

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is not the member of class?

((OPTION_A))

Static function

((OPTION_B))

Friend function

((OPTION_C))

Const function

((OPTION_D))

Virtual function

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Pick the other name of operator function.

((OPTION_A))

function overloading

((OPTION_B))

operator overloading

((OPTION_C))

member overloading

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following operators can’t be overloaded?

((OPTION_A))

::

((OPTION_B))

+

((OPTION_C))

((OPTION_D))

[]

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

How to declare operator function?

((OPTION_A))

operator operator sign

((OPTION_B))

operator

((OPTION_C))

operator sign

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following statements is NOT valid about operator overloading?

((OPTION_A))

Only existing operators can be overloaded.

((OPTION_B))

Overloaded operator must have at least one operand of its class type.

((OPTION_C))

The overloaded operators follow the syntax rules of the original operator.

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Operator overloading is

((OPTION_A))

making c++ operator works with objects

((OPTION_B))

giving new meaning to existing operator

((OPTION_C))

making new operator

((OPTION_D))

both a & b

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

What is the #include <iostream>

using namespace std;

ostream & operator<<(ostream & i, int n)

{

return i;

}

int main()

{

cout << 5 << endl;

cin.get();

return 0;

}

output of this program?

((OPTION_A))

5

((OPTION_B))

6

((OPTION_C))

error

((OPTION_D))

runtime error

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

You can redefine the way _______ work when used with objects.

((OPTION_A))

none of these

((OPTION_B))

white space characters

((OPTION_C))

standard operators

((OPTION_D))

pre-processor directives

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

In Turbo C++, if you overload only prefix ++ operator, the postfix ++ operator ________.

((OPTION_A))

does not work

((OPTION_B))

works arbitrarily

((OPTION_C))

works naturally

((OPTION_D))

works as if prefix ++ operator

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Why we use the “dynamic_cast” type conversion?

((OPTION_A))

result of the type conversion is a valid

((OPTION_B))

to be used in low memory

((OPTION_C))

result of the type conversion is a invalid

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Which is used to create a pure virtual function ?

((OPTION_A))

) $

((OPTION_B))

=0

((OPTION_C))

&

((OPTION_D))

!

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which is also called as abstract class?

((OPTION_A))

virtual function

((OPTION_B))

pure virtual function

((OPTION_C))

derived class

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

What is meant by pure virtual function?

((OPTION_A))

Function which does not have definition of its own.)

((OPTION_B))

Function which does have definition of its own.

((OPTION_C))

Function which does not have any return type.

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Pick out the correct option.

((OPTION_A))

We cannot make an instance of an abstract base class

((OPTION_B))

We can make an instance of an abstract base class

((OPTION_C))

Both a & b

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Where does the abstract class is used?

((OPTION_A))

base class only

((OPTION_B))

derived class

((OPTION_C))

both a & b

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

How many access specifiers are there in c++?

((OPTION_A))

1

((OPTION_B))

2

((OPTION_C))

3

((OPTION_D))

4

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

What is the default access level to a block of data?

((OPTION_A))

Public

((OPTION_B))

Protected

((OPTION_C))

Private

((OPTION_D))

None of the mentioned

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

A pointer to the base class can hold address of

((OPTION_A))

only base class object

((OPTION_B))

only derived class object

((OPTION_C))

base class object as well as derived class object

((OPTION_D))

None of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Use of virtual functions implies

((OPTION_A))

overloading.

((OPTION_B))

overriding.

((OPTION_C))

static binding.

((OPTION_D))

dynamic binding.

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Pure virtual functions

((OPTION_A))

have to be redefined in the inherited class.

((OPTION_B))

cannot have public access specification.

((OPTION_C))

are mandatory for a virtual class.

((OPTION_D))

None of the above.

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

A struct is the same as a class except that

((OPTION_A))

there are no member functions.

((OPTION_B))

all members are public.

((OPTION_C))

cannot be used in inheritance hierarchy.

((OPTION_D))

it does have a this pointer.

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The keyword friend does not appear in

((OPTION_A))

the class allowing access to another class.

((OPTION_B))

the class desiring access to another class.

((OPTION_C))

the private section of a class.

((OPTION_D))

the public section of a class.

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

RunTime Polymorphism is achieved by ______

((OPTION_A))

friend function

((OPTION_B))

virtual function

((OPTION_C))

operator overloading

((OPTION_D))

function overloading

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access

((OPTION_A))

protected and public data only in C and B.

((OPTION_B))

protected and public data only in C.

((OPTION_C))

private data in A and B.

((OPTION_D))

protected data in A and B.

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

The process of building new classes from existing one is called ______.

((OPTION_A))

Polymorphism

((OPTION_B))

Structure

((OPTION_C))

Inheritance

((OPTION_D))

Cascading

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is an invalid visibility label while inheriting a class?

((OPTION_A))

public

((OPTION_B))

private

((OPTION_C))

protected

((OPTION_D))

friend

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which inheritance type is used in the class given below?

class A : public X, public Y {}

((OPTION_A))

Multilevel inheritance

((OPTION_B))

Multiple inheritance

((OPTION_C))

Hybrid inheritance

((OPTION_D))

Hierarchical Inheritance

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following keyword is used to overload an operator?

((OPTION_A))

overload

((OPTION_B))

operator

((OPTION_C))

friend

((OPTION_D))

override

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which one of the following is the correct way to declare a pure virtual function?

((OPTION_A))

A.virtual void Display(void){0};

((OPTION_B))

virtual void Display = 0;

((OPTION_C))

virtual void Display(void) = 0;

((OPTION_D))

Void Display(void) = 0;

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is not a type of inheritance?

((OPTION_A))

Multiple

((OPTION_B))

Multilevel

((OPTION_C))

Distributive

((OPTION_D))

Hierarchical

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following are available only in the class hierarchy chain?

((OPTION_A))

Public data members

((OPTION_B))

Private data members

((OPTION_C))

Protected data members

((OPTION_D))

Member functions

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

What happens if the base and derived class contains definition of a function with same prototype?

((OPTION_A))

Compiler reports an error on compilation.

((OPTION_B))

Only base class function will get called irrespective of object.

((OPTION_C))

Only derived class function will get called irrespective of object.

((OPTION_D))

Base class object will call base class function and derived class object will call derived class function.

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is correct about the statements given below?

1.All operators can be overloaded in C++.

2.We can change the basic meaning of an operator in C++.

((OPTION_A))

A.Only I is true.

((OPTION_B))

Both I and II are false.

((OPTION_C))

Only II is true.

((OPTION_D))

Both I and II are true.

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is a mechanism of static polymorphism?

((OPTION_A))

Operator overloading

((OPTION_B))

Function overloading

((OPTION_C))

Templates

((OPTION_D))

All of the above

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following concepts is used to implement late binding?

((OPTION_A))

Virtual function

((OPTION_B))

Operator function

((OPTION_C))

Const function

((OPTION_D))

Static function

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following cannot be used with the keyword virtual?

((OPTION_A))

class

((OPTION_B))

member functions

((OPTION_C))

constructor

((OPTION_D))

destructor

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following operator is overloaded for object cout?

((OPTION_A))

>>

((OPTION_B))

<<

((OPTION_C))

+

((OPTION_D))

=

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

How “Late binding” is implemented in C++?

((OPTION_A))

Using C++ tables

((OPTION_B))

Using Virtual tables

((OPTION_C))

Using polymorphic tables

((OPTION_D))

Using Indexed virtual tables

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is correct about class and structure?

((OPTION_A))

Class can have member functions while structure cannot.

((OPTION_B))

class data members are public by default while that of structure are private

((OPTION_C))

Pointer to structure or classes cannot be declared.

((OPTION_D))

Class data members are private by default while that of structure are public by default.

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following is correct about function overloading?

((OPTION_A))

The types of arguments are different.

((OPTION_B))

The order of argument is different.

((OPTION_C))

The number of argument is same.

((OPTION_D))

Both A and B.

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Operator overloading is ?

((OPTION_A))

giving new meaning to existing c++ operators

((OPTION_B))

making c++ operators work with objects

((OPTION_C))

giving c++ operators more than they can handle

((OPTION_D))

making new c++ operators

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

A base class will offer

((OPTION_A))

Offer more specific objects than its derived classes

((OPTION_B))

correspond to something in the rest world

((OPTION_C))

behave badly when the chops are down

((OPTION_D))

be a generalized version of its derived classes

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Choose most appropriate statement

((OPTION_A))

An abstract base class can have pure virtual destructor

((OPTION_B))

An abstract base class can have only virtual destructor

((OPTION_C))

An abstract base class can have non virtual destructor

((OPTION_D))

An abstract base class cannot have destructor

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

Can we pass parameters to base class constructor though derived class or derived class constructor?

((OPTION_A))

Yes

((OPTION_B))

No

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Private members of the class are not inheritable.

((OPTION_A))

True

((OPTION_B))

False

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Can struct be used as Base class for inheritance ?

((OPTION_A))

Yes

((OPTION_B))

No

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

The ……………. inherits some or all of the properties of the ……….. class.

((OPTION_A))

base, derived

((OPTION_B))

derived, base

((OPTION_C))

derived, initial

((OPTION_D))

base, final

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

A derived class with only one base class is called …………… inheritance.

((OPTION_A))

single

((OPTION_B))

multiple

((OPTION_C))

multilevel

((OPTION_D))

hierarchical

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

A class can inherit properties from more than one class which is known as ……….inheritance.

((OPTION_A))

single

((OPTION_B))

multiple

((OPTION_C))

multilevel

((OPTION_D))

hierarchical

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

State whether the following statements about inheritance are True or False.
i) A public member of a class can be accessed by its own objects using the dot operator.
ii) While inheriting, the private members of the base class will never become the members of its derived class.

((OPTION_A))

True, False

((OPTION_B))

False, True

((OPTION_C))

True, True

((OPTION_D))

False, False

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

When the base class is publicly inherited, public members of the base class become …………. of the derived class.

((OPTION_A))

private members

((OPTION_B))

protected members

((OPTION_C))

Public members

((OPTION_D))

Not inherited

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

In protected derivation, both the public and protected members of the base class become …………. members of the derived class.

((OPTION_A))

protected

((OPTION_B))

private

((OPTION_C))

public

((OPTION_D))

friend

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

What will be the order of execution of base class constructors in the following method of inheritance. class A: public B, public C {….};

((OPTION_A))

B(); C(); A();

((OPTION_B))

C(); B(); A();

((OPTION_C))

A(); B(); C();

((OPTION_D))

B(); A(); C();

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

What will be the order of execution of base class constructors in the following method of inheritance. class A: public B, virtual public C {….};

((OPTION_A))

B(); C(); A();

((OPTION_B))

C(); B(); A();

((OPTION_C))

A(); B(); C();

((OPTION_D))

B(); A(); C();

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

While the friend functions and the member functions of a friend class can have direct access to both the private and protected data, the member functions of a derived class can directly access only the ………… data.

((OPTION_A))

protected

((OPTION_B))

private

((OPTION_C))

public

((OPTION_D))

friend

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

In ……………………. inheritance, the constructors are executed in the order of inheritance.

((OPTION_A))

multipath

((OPTION_B))

multiple

((OPTION_C))

multilevel

((OPTION_D))

hierarchical

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

……………….. inheritance may lead to duplication of inherited members from a ‘grandparent’ base class.

((OPTION_A))

multipath

((OPTION_B))

multiple

((OPTION_C))

multilevel

((OPTION_D))

hierarchical

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

The friend functions and the member functions of a friend class can directly access the ………………. data.

((OPTION_A))

private and protected

((OPTION_B))

private and public

((OPTION_C))

protected and public

((OPTION_D))

private, protected and public

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

The advantage of declaring a virtual function as pure is

((OPTION_A))

you can avoid making the class an abstract class

((OPTION_B))

you force any derived class to define its own implementation

((OPTION_C))

programs runs faster

((OPTION_D))

early binding can be achieved

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Inheritance is ……….. in nature

((OPTION_A))

transitive

((OPTION_B))

intransitive

((OPTION_C))

both (a) & (b)

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

The following feature supports extensibility and reusability of classes

((OPTION_A))

function overloading

((OPTION_B))

inheritance

((OPTION_C))

operator overloading

((OPTION_D))

data encapsulation

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

Which of the following statements regarding operator overloading is false?

((OPTION_A))

friend function cannot be used to overload certain operators.

((OPTION_B))

Unary operators overloaded by means of friend functions takes no argument

((OPTION_C))

Binary operators must explicitly return a value

((OPTION_D))

The syntax rules of the operators cannot be overridden.

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

A unary operator when overloaded takes

((OPTION_A))

no operand
b)
c)
d)

((OPTION_B))

one operand

((OPTION_C))

two operands

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

The following operator can’t be overloaded

((OPTION_A))

unary

((OPTION_B))

binary

((OPTION_C))

ternary

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The operator functions may be invoked

((OPTION_A))

implicitly

((OPTION_B))

explicitly

((OPTION_C))

both (a) & (b)

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The operator function

((OPTION_A))

is declared in the public section of the class

((OPTION_B))

may be a member function or a friend function

((OPTION_C))

both (a) & (b)

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

& operator is

((OPTION_A))

indirection operator

((OPTION_B))

Logical AND

((OPTION_C))

address operator

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

When an arithmetic assignment operator is overloaded, the result

((OPTION_A))

goes in the object to the left of the operator

((OPTION_B))

goes in the object to the right of the operator

((OPTION_C))

goes in the object of which the operator is a member

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Overloading of constructor function

((OPTION_A))

is similar to function overloading

((OPTION_B))

different from an overloaded function as it can’t return a value

((OPTION_C))

not permitted in C++

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

B

((MARKS)) (1/2/3…)

1

((QUESTION))

The signature of function is

((OPTION_A))

The number & type of arguments

((OPTION_B))

The return type of a function

((OPTION_C))

The class definition

((OPTION_D))

None of the above

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

Function overloading

((OPTION_A))

Involves several function definitions under one name, but different argument types

((OPTION_B))

Implements polymorphism

((OPTION_C))

Reduces the number of comparison in a program, hence increases the execution speed of a program

((OPTION_D))

All of the above

((CORRECT_CHOICE)) (A/B/C/D)

D

((MARKS)) (1/2/3…)

1

((QUESTION))

If new operator is used, then the constructor function is

((OPTION_A))

Parameterized constructor

((OPTION_B))

Copy constructor

((OPTION_C))

Dynamic constructor

((OPTION_D))

Default constructor

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

The class of which the objects are not instantiated is

((OPTION_A))

Abstract class

((OPTION_B))

Virtual class

((OPTION_C))

Static class

((OPTION_D))

None of the above

((CORRECT_CHOICE)) (A/B/C/D)

A

((MARKS)) (1/2/3…)

1

((QUESTION))

? is an example of

((OPTION_A))

unary operator

((OPTION_B))

binary operator

((OPTION_C))

ternary operator

((OPTION_D))

none of the above

((CORRECT_CHOICE)) (A/B/C/D)

C

((MARKS)) (1/2/3…)

1

((QUESTION))

A class whose member functions are friends of other class is

((OPTION_A))

Friend class

((OPTION_B))

Abstract class

((OPTION_C))

Virtual class

((OPTION_D))

None of the above

((CORRECT_CHOICE)) (A/B/C/D)

A

 

error: Content is protected !!