C++ MCQs with answers Page - 92

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. Find the output of below program.

Code:
int main() 
{
int i = 0, x = 0;

do
{
    if(i % 5 == 0)
    {
       cout<<x;
       x++;
    }

    ++i;
}while(i<10);

cout<<x;

return 0;
}
  • (A) 0
  • (B) 01
  • (C) 012
  • (D) 0123

A

Admin • 833.24K Points
Coach

Q. What should be output of below program
if use enter a = 5?

Code:
int main()
{
    int a;
    cin>>a; // user can enter any value
    
	if (++a*5 <= 25)
	{
	    cout<<"Hello";
	}
	else
	{
	    cout<<"Bye";	
	}

}
  • (A) Hello
  • (B) Bye
  • (C) Undefined
  • (D) Compilation Error

A

Admin • 833.24K Points
Coach

Q. How many Access specifier are there in C++?

  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 4

A

Admin • 833.24K Points
Coach

Q. What is VTable?

  • (A) It contains VPTR
  • (B) It contains address of Virtual function
  • (C) It cotains address of Object
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. Is there any difference in below two statements?

Code:
int a = 10;
int a(10);
  • (A) Yes
  • (B) No
  • (C) May Be
  • (D) Can not say

A

Admin • 833.24K Points
Coach

Q. How to stop Name Mangling in C++?

  • (A) By Converting C++ code to C
  • (B) By using extern "C" keyword
  • (C) It is possible only with C code
  • (D) It is not possible

A

Admin • 833.24K Points
Coach

Q. Which of the following is Memory Leak detection tool?

  • (A) Valgrind
  • (B) GIT
  • (C) KDevelop
  • (D) GC++

A

Admin • 833.24K Points
Coach

Q. Exceptions are Caught at ?

  • (A) No
  • (B) Linking Time
  • (C) Run Time
  • (D) Compilation Time

A

Admin • 833.24K Points
Coach

Q. When can we have two classes with same name?

  • (A) We can have in any scenario
  • (B) Can have but in different file
  • (C) In different work space
  • (D) We cant have

A

Admin • 833.24K Points
Coach

Q. What is the size of empty class?

  • (A) 0
  • (B) 1
  • (C) 2
  • (D) 4

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