C++ MCQs with answers Page - 161

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. What will be the output of the following code?

int a = 10, b = 3;
cout << a % b;

  • (A) 1
  • (B) 3
  • (C) 0
  • (D) 10

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about virtual functions in C++?

  • (A) They allow dynamic binding
  • (B) They cannot be overridden
  • (C) They must have a different return type
  • (D) They are not allowed in derived classes

A

Admin • 833.24K Points
Coach

Q. Which operator is used to access the member of a namespace?

  • (A) ->
  • (B) ::
  • (C) .
  • (D) &

A

Admin • 833.24K Points
Coach

Q. Which header file is required to use file handling in C++?

  • (A) fstream
  • (B) file
  • (C) iostream
  • (D) string

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to prevent a function from being overridden in derived classes?

  • (A) constant
  • (B) final
  • (C) static
  • (D) override

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about function templates in C++?

  • (A) They allow functions to work with any data type
  • (B) They can only be used with integers
  • (C) They require explicit type specification
  • (D) They cannot be used with classes

A

Admin • 833.24K Points
Coach

Q. Which C++ feature allows different functions to have the same name but different parameters?

  • (A) Function Overloading
  • (B) Function Overriding
  • (C) Encapsulation
  • (D) Polymorphism

A

Admin • 833.24K Points
Coach

Q. Which of the following is used to prevent multiple inclusions of a header file?

  • (A) #define
  • (B) #ifndef
  • (C) #include
  • (D) #pragma

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to define a class that cannot be instantiated?

  • (A) abstract
  • (B) virtual
  • (C) private
  • (D) protected

A

Admin • 833.24K Points
Coach

Q. Which of the following is the correct syntax for defining a pointer to an integer in C++?

  • (A) int ptr;
  • (B) int *ptr;
  • (C) int &ptr;
  • (D) pointer<int> ptr;

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