C++ MCQs with answers Page - 129

Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are correct for a static member function? 1. It can access only other static members of its class. 2. It can be called using the class name, instead of objects.

  • (A) Only 1 is correct.
  • (B) Only 2 is correct.
  • (C) Both 1 and 2 are correct.
  • (D) Both 1 and 2 are incorrect.

A

Admin • 833.24K Points
Coach

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

  • (A) Encapsulation
  • (B) Inheritance
  • (C) Composition
  • (D) Abstraction

A

Admin • 833.24K Points
Coach

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

  • (A) Public members of the base class become protected members of derived class.
  • (B) Public members of the base class become private members of derived class.
  • (C) Private members of the base class become protected members of derived class.
  • (D) Public members of the base class become public members of derived class

A

Admin • 833.24K Points
Coach

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

  • (A) Destructors can take arguments but constructors cannot.
  • (B) Constructors can take arguments but destructors cannot.
  • (C) Destructors can be overloaded but constructors cannot be overloaded.
  • (D) Constructors and destructors can both return a value.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) C++ enables to define functions that take constants as an argument.
  • (B) We cannot change the argument of the function that that are declared as constant.
  • (C) Both A and B.
  • (D) We cannot use the constant while defining the function.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument.
  • (B) Overloaded function must have default arguments.
  • (C) Overloaded function must have default arguments starting from the left of argument list.
  • (D) A function can be overloaded more than once.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement will be correct if the function has three arguments passed to it?

  • (A) The trailing argument will be the default argument.
  • (B) The first argument will be the default argument.
  • (C) The middle argument will be the default argument.
  • (D) All the argument will be the default argument.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is incorrect?

  • (A) Default arguments can be provided for pointers to functions.
  • (B) A function can have all its arguments as default.
  • (C) Default argument cannot be provided for pointers to functions.
  • (D) A default argument cannot be redefined in later declaration.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) Constructors can have default parameters.
  • (B) Constructors cannot have default parameters.
  • (C) Constructors cannot have more than one default parameter.
  • (D) Constructors can have at most five default parameters.

A

Admin • 833.24K Points
Coach

Q. Which of the following function / type of function cannot be overloaded?

  • (A) Member function
  • (B) Static function
  • (C) Virtual function
  • (D) Both B and C