C++ MCQs with answers Page - 154

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 C++ features is used to achieve polymorphism?

  • (A) Function Overloading
  • (B) Function Overriding
  • (C) Both A and B
  • (D) None of the above

A

Admin • 833.24K Points
Coach

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

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

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

A

Admin • 833.24K Points
Coach

Q. Which of the following data types can store floating-point numbers in C++?

  • (A) int
  • (B) double
  • (C) char
  • (D) boolean

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about C++ arrays?

  • (A) Arrays in C++ can store elements of different data types.
  • (B) The size of an array is fixed and cannot be changed after declaration.
  • (C) Arrays in C++ start at index 1.
  • (D) C++ arrays do not have a fixed size.

A

Admin • 833.24K Points
Coach

Q. Which of the following C++ operators is used to dereference a pointer?

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

A

Admin • 833.24K Points
Coach

Q. Which of the following is the correct syntax to include a C++ library?

  • (A) #include <iostream>
  • (B) import <iostream>
  • (C) include <iostream>
  • (D) use <iostream>

A

Admin • 833.24K Points
Coach

Q. What is the purpose of the 'static' keyword in C++?

  • (A) To define a global variable
  • (B) To define a constant variable
  • (C) To limit the scope of a variable to its function
  • (D) To make a variable accessible to all functions

A

Admin • 833.24K Points
Coach

Q. Which of the following is the correct way to declare an array of 5 integers in C++?

  • (A) int arr[5];
  • (B) int[5] arr;
  • (C) arr[5] int;
  • (D) int[] arr;

A

Admin • 833.24K Points
Coach

Q. Which of the following C++ classes is used for handling input and output?

  • (A) fstream
  • (B) iostream
  • (C) stdio
  • (D) outputstream

A

Admin • 833.24K Points
Coach

Q. Which C++ function is used to get the length of a string?

  • (A) length()
  • (B) size()
  • (C) strlen()
  • (D) getLength()

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