C++ MCQs with answers Page - 20

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 is the scope resolution operator?

  • (A) ~
  • (B) ::
  • (C) *
  • (D) .

A

Admin • 833.24K Points
Coach

Q. What is the output of the following C++ code?

Code:
#include<iostream>
using namespace std;
int arr[50];
int main()
{
    cout << arr[49] << endl;
}
  • (A) Random value
  • (B) 49
  • (C) 0
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Which of the following is accessed by a member function of a class?

  • (A) The object of this class
  • (B) Public part of the class
  • (C) Private part of the class
  • (D) All members of the class

A

Admin • 833.24K Points
Coach

Q. What is the size of a character in C and C++?

  • (A) 4 et 1
  • (B) 1 et 4
  • (C) 1 et 1
  • (D) 4 et 4

A

Admin • 833.24K Points
Coach

Q. Which variable does equals in size with enum variable?

  • (A) string variable
  • (B) float variable
  • (C) int variable
  • (D) All of above

A

Admin • 833.24K Points
Coach

Q. Public data members and member functions of the class are accessible ONLY to the member functions of that class.

  • (A) True
  • (B) False
  • (C) Either A or B
  • (D) None of the above

A

Admin • 833.24K Points
Coach

Q. Only functions of the class can access the data of the class and they(functions) provides the interface between data, objects and the program. This kind isolation of the data from direct access by the program is called _______________ .

  • (A) Data Abstraction
  • (B) Data Hiding
  • (C) Data Binding
  • (D) Data Encapsulation

A

Admin • 833.24K Points
Coach

Q. A Constructor that does not have any parameters is called____________ Constructor.

  • (A) Custom
  • (B) Dynamic
  • (C) Static
  • (D) Default

A

Admin • 833.24K Points
Coach

Q. What will happen when defining the enumerated type?

  • (A) it will not allocate memory to its variables
  • (B) it will allocate memory
  • (C) it will not allocate memory
  • (D) All of above

A

Admin • 833.24K Points
Coach

Q. To which of these enumerators can be assigned?

  • (A) enumerator
  • (B) negative
  • (C) integer
  • (D) All of above