C++ MCQs with answers Page - 38

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 is not true about preprocessor directives?

  • (A) They end with a semi-colon
  • (B) These must be written on a single line
  • (C) They do not produce code by themselves
  • (D) These are lines read and processed by the preprocessor

A

Admin • 833.24K Points
Coach

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

Code:
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
  int arr[] = {100, 200, 300};
  cout << -2[arr];
  return 0;
}
  • (A) Runtime error
  • (B) Compilation error
  • (C) -300
  • (D) 300

A

Admin • 833.24K Points
Coach

Q. Which of the following statements is true about the following instruction?

  • (A) Creates a variable of type integer with the identifier b and 100 as value.
  • (B) Declares a constant b whose value will be 100.
  • (C) Declare an integer b with 100 as initial value.
  • (D) Declares a variable b with 100 as initial value.

A

Admin • 833.24K Points
Coach

Q. Which variable is equal to the size of enum variable?

  • (A) int var;
  • (B) float var;
  • (C) string var;
  • (D) None of the above

A

Admin • 833.24K Points
Coach

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

Code:
#include <iostream>
using namespace std;
int main()
{
  int x = 10;
  if (x < 10) {
    for (i = 0; i < 10; i++)
      cout << i;
  }
  else {
    cout << i;
  }
  return 0;
}
  • (A) Compilation error
  • (B) 012345678
  • (C) 123456789
  • (D) 12345678910

A

Admin • 833.24K Points
Coach

Q. The elements in a structure are also called _______

  • (A) objets
  • (B) data
  • (C) members
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. Additive, Multiplicative, shift, Bitwise logical and assignment operators is ____ operator.

  • (A) Binary
  • (B) Unary
  • (C) Relational
  • (D) Conditional

A

Admin • 833.24K Points
Coach

Q. Binary plus (+) and Binary minus (-) are ___ operator.

  • (A) Bitwise
  • (B) Shift
  • (C) Multiplicative
  • (D) Additive

A

Admin • 833.24K Points
Coach

Q. What is the length of double data type?

  • (A) 64
  • (B) 32
  • (C) 16
  • (D) 8

A

Admin • 833.24K Points
Coach

Q. Which operator requires three operands?

  • (A) Bitwise
  • (B) Ternary
  • (C) Binary
  • (D) Unary

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