C++ MCQs with answers Page - 130

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 statement is incorrect?

  • (A) The default value for an argument can be a global constant.
  • (B) The default arguments are given in the function prototype.
  • (C) Compiler uses the prototype information to build a call, not the function definition.
  • (D) The default arguments are given in the function prototype and should be repeated in the function definition.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) The default value for an argument cannot be function call.
  • (B) C++ allows the redefinition of a default parameter.
  • (C) Both A and B.
  • (D) C++ does not allow the redefinition of a default parameter.

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) Only one parameter of a function can be a default parameter.
  • (B) Minimum one parameter of a function must be a default parameter.
  • (C) All the parameters of a function can be default parameters.
  • (D) No parameter of a function can be default.

A

Admin • 833.24K Points
Coach

Q. Which of the following function / types of function cannot have default parameters?

  • (A) Member function of class
  • (B) main()
  • (C) Member function of structure
  • (D) Both B and C

A

Admin • 833.24K Points
Coach

Q. A constructor that accepts __________ parameters is called the default constructor.

  • (A) one
  • (B) two
  • (C) no
  • (D) three

A

Admin • 833.24K Points
Coach

Q. What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero‐argument constructor?

  • (A) Compile‐time error.
  • (B) Preprocessing error.
  • (C) Runtime error.
  • (D) Runtime exception.

A

Admin • 833.24K Points
Coach

Q. Destructor has the same name as the constructor and it is preceded by ______ .

  • (A) !
  • (B) ?
  • (C) ~
  • (D) $

A

Admin • 833.24K Points
Coach

Q. Which constructor function is designed to copy objects of the same class type?

  • (A) Create constructor
  • (B) Object constructor
  • (C) Dynamic constructor
  • (D) Copy constructor

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is correct?

  • (A) Constructor has the same name as that of the class.
  • (B) Destructor has the same name as that of the class with a tilde symbol at the beginning.
  • (C) Both A and B.
  • (D) Destructor has the same name as the first member function of the class.

A

Admin • 833.24K Points
Coach

Q. When are the Global objects destroyed?

  • (A) When the control comes out of the block in which they are being used.
  • (B) When the program terminates.
  • (C) When the control comes out of the function in which they are being used.
  • (D) As soon as local objects die.

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ