C++ MCQs with answers Page - 93

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 is abstract class?

  • (A) Empty Class
  • (B) A class with atleast one pure virtual function
  • (C) A class with no functions in it
  • (D) A class with abstract keyword

A

Admin • 833.24K Points
Coach

Q. How many object can be created of a Class in C++?

  • (A) 1
  • (B) 2
  • (C) 256
  • (D) There is no limit

A

Admin • 833.24K Points
Coach

Q. When Virtual Table is created?

  • (A) Class has atleast one Virtual Function
  • (B) When a Class Overrides the function of Base class
  • (C) Class inherited from other Class
  • (D) Every Class has VTable

A

Admin • 833.24K Points
Coach

Q. Find the output of below program?

Code:
#include<iostream>
using namespace std;

int main()
{

cout<<-1-1-1;

return 0;
}
  • (A) -3
  • (B) 0
  • (C) 3
  • (D) Compilation Error

A

Admin • 833.24K Points
Coach

Q. Find the output of below program.

Code:
#include <iostream>
using namespace std;

class X
{
public: X()
        { cout<<"X"; }
        ~X()
        { cout<<"~X"; }
};

class Y : public X
{
public: Y()
        { cout<<"Y"; }
        ~Y()
        { cout<<"~Y"; }
};

int main()
{
    Y obj;
    return 0;
}
  • (A) X~X~YY
  • (B) X~XY~Y
  • (C) XY~Y~X
  • (D) XY~X~Y

A

Admin • 833.24K Points
Coach

Q. Find the output of below program.

Code:
class Mycpp
{
    
};

int main()
{
    Mycpp obj;
    return 0;
}
  • (A) Compilation Error - Constructor Missing
  • (B) Nothing would be printed
  • (C) Undefined
  • (D) In constructor

A

Admin • 833.24K Points
Coach

Q. Find the output of below program.

Code:
class Mycpp
{
    int Mycpp()
    {
       cout<<"Constructor";
       return 0;
     }
};

int main()
{
    Mycpp obj;
    return 0;
}
  • (A) 0
  • (B) Constructor
  • (C) Runtime Error
  • (D) Compilation Error

A

Admin • 833.24K Points
Coach

Q. C++ is superset of which langauge?

  • (A) C
  • (B) PASCAL
  • (C) VB
  • (D) BASIC

A

Admin • 833.24K Points
Coach

Q. What is size of void in C++?

  • (A) 0
  • (B) 2 Bytes
  • (C) 4 Bytes
  • (D) Undefined

A

Admin • 833.24K Points
Coach

Q. What should be the output of below program?

Code:
int main()
{
    int a = 1;
    switch(a)
    {
    case 1: cout<<"One";
    case 2: cout<<"Two";
    case 3: cout<<"Three";
    default: cout<<"Default";
    }
    return 0;

}
  • (A) Default
  • (B) One
  • (C) OneTwoThree
  • (D) Compilation 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