Top 80+ Solved CPP Programming MCQ Questions Answer

From 16 to 30 of 86

Q. A member function can always access the data in __________, (in C++).

a. the class of which it is member

b. the object of which it is a member

c. the public part of its class

d. the private part of its class

  • a. the class of which it is member

Q. Which of the following is not correct for virtual function in C++?

a. Must be declared in public section of class.

b. Virtual function can be static.

c. Virtual function should be accessed using pointers.

d. Virtual function is defined in base class.

  • b. Virtual function can be static.

Q. Which of the following cannot be passed to a function in C++?

a. Constant

b. Structure

c. Array

d. Header file

  • d. Header file

Q. Which of the following, in C++, is inherited in a derived class from base class?

a. Constructor

b. Destructor

c. Data members

d. Virtual methods

  • c. Data members

Q. Which of the following is a correct statement?

a. Composition is a strong type of association between two classes with full ownership.

b. Composition is a strong type of association between two classes with partial ownership.

c. Composition is a weak type of association between two classes with partial ownership.

d. Composition is a weak type of association between two classes with strong ownership.

  • a. Composition is a strong type of association between two classes with full ownership.

Q. Which of the following is not a correct statement?

a. Every class containing abstract method must be declared abstract.

b. Abstract class can directly be initiated with ‘new’ operator.

c. Abstract class can be initiated.

d. Abstract class does not contain any definition of implementation.

  • b. Abstract class can directly be initiated with ‘new’ operator.

Q. When one object reference variable is assigned to another object reference variable then

a. a copy of the object is created.

b. a copy of the reference is created.

c. a copy of the reference is not created.

d. it is illegal to assign one object reference variable to another object reference variable.

  • b. a copy of the reference is created.

Q. Which of the following is not a member of class?

a. Static function

b. Friend function

c. Const function

d. Virtual function

  • b. Friend function

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

a. By overloading new operator

b. By making an empty private new operator.

c. By making an empty private new and new[] operators

d. By overloading new operator and new[] operators

  • c. By making an empty private new and new[] operators

Q. Which of the following operators cannot be overloaded?

a. . (Member Access or Dot operator)

b. ?: (Ternary or Conditional Operator)

c. :: (Scope Resolution Operator)

d. All of the above

  • d. All of the above

Q. Which of the following operators should be preferred to overload as a global function rather than a member method?

a. Postfix ++

b. Comparison Operator

c. Insertion Operator <<

d. Prefix++

  • c. Insertion Operator <<
Subscribe Now

Get All Updates & News