C++ MCQs with answers Page - 9

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 functions can be inherited from base class?

  • (A) Constructor
  • (B) Destructor
  • (C) Static
  • (D) None

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
  Float a = 5;
  switch(a){
     Case 5: cout <<”Brijesh”;
     Default: cout <<”Goswami”;
  }
}
  • (A) Brijesh
  • (B) Goswami
  • (C) BrijeshGoswami
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
  int a = 10, b, c;
  b  = a++;
  c = a;
  cout << a << “ “ <<b <<” “<< c << endl;
}
  • (A) 10 11 11
  • (B) 11 11 11
  • (C) 11 10 11
  • (D) 10 10 10

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program

Code:
main(){
  int a, b = 10;
  a = 95 / 10;
  cout << a << endl;
}
  • (A) 9
  • (B) 9.5
  • (C) 10
  • (D) 9.0

A

Admin • 833.24K Points
Coach

Q. How many times will the print statement be executed?

Code:
main(){
  int i = 0;
  label:
  cout << “MCQBuddy;
  i++;
  if(i < 3){
    goto label;
  }
}
  • (A) 1 time
  • (B) 2 times
  • (C) 3 times
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
 cout <<  -10 - 10 -10;
}
  • (A) 0
  • (B) -30
  • (C) 30
  • (D) 20

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
 int a = 10 / 0;
}
  • (A) 0
  • (B) Compilation error
  • (C) exception
  • (D) None

A

Admin • 833.24K Points
Coach

Q. Identify the correct escape sequence used for the new line.

  • (A)
  • (B)
  • (C) a
  • (D) None

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
 char ch[] = “Interviewbit Scaler”; 
 int l = strlen(ch);
 cout << l << endl;
}
  • (A) 18
  • (B) 19
  • (C) 20
  • (D) 21

A

Admin • 833.24K Points
Coach

Q. Find the output of the following program.

Code:
main(){
 int i = (1, 2, 3);
 cout << i << endl;
}
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) Error

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