C++ Programming Questions with Solutions - 2

Question: 6

In new operator

(A) Each link contains data or a pointer to data

(B) Each link contains a pointer to the next link

(C) Links are stored in an array

(D) An array of pointers point to the links

Ans: B

Each link contains a pointer to the next link

Question: 7

A virtual base class is useful when

(A) It makes sense to use a base class is ambiguous

(B) Identification of a function in a base class is ambiguous

(C) There are multiple paths from one derived class to another

(D) Different functions in base and derived classes have the same name

Ans: B

Identification of a function in a base class is ambiguous

Question: 8

The keyword void is used to declare

(A) Objects that can be modified outside of program control

(B) A synonym for an existing type

(C) A member function that is defined in a subclass

(D) Absence of a type

Ans: C

A member function that is defined in a subclass

Question: 9

Virtual functions allow to

(A) Use same function call to execute member functions of objects from different classes

(B) Group objects of different classes so they can all be accessed by the same function code

(C) Create functions that have no body

(D) Create an array of type pointer to base calls that can hold pointers to derived classes

Ans: A

Use same function call to execute member functions of objects from different classes

Question: 10

Classes are useful because they

(A) Can closely model objects in the real world

(B) Bring together all aspects of an entity in one place

(C) Permit data to be hidden from other classes

(D) Are removed from memory when not in use

Ans: C

Permit data to be hidden from other classes

Related Questions