C++ Programming Quiz


Play this c++ quiz that will help you to excel in C++ certification exams, placements etc. This C++ programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This C++ programming test enables you to assess your knowledge of C++ programming.

Take the Free Practice Test



C++ MCQs

Practice C++ MCQ Questions, which will help you to understand C++ programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

C++ Quiz

Try Free C++ Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

C++ Quiz

1. How to handle error in the destructor?

Throwing
Terminate
Both throwing & terminate
None of the above

2. Which of the following is correct option?

    #include<iostream>
    using namespace std;
    namespace lfc1
    {
        int x = 10;
    }
    namespace lfc2
    {
        int x = 20;
    }
    int main ()
    {
        int x = 30;
        lfc1::x;
        lfc2::x;
        cout << x;
        return 0;
    }

30
20
10
Compile Error

3. If many functions-have the same name, which of the following information, if present, will be used by the compiler to invoke the correct function to be used?

The operator : :
The return value of the function
Function signature
Both A & C

4. What is the output of this program?

         
Note:Includes all required header files
using namespace std;
 
class Empty { };
 
class Derived: Empty { int a; };
 
int main()
{
    cout << sizeof(Derived);
    return 0;
}

1
2
4
Error

5. Which operator is used to signify the namespace in c++?

conditional operator
ternary operator
scope operator
None of the mentioned

6. What is the output of this program?

#include <iostream>
using namespace std;
class team
{ 
    public : int member; 
    void LFC() 
    { 
	    cout<<"Its base class";
    };
};
class course:public team
{
    public : 
    void LFC()
    { 
      cout<<"Its derived class"; 
    }
};

int main() 
{ 
team t; course c;
t.LFC();
c.LFC();
} 

Its base classIts derived class
Its base class Its derived class
Its derived classIts base class
Its derived class Its base class

7. What is size of generic pointer in c?

0
1
2
Null

8. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.

Inheritance
Polymorphism
Abstraction
Encapsulation

9. Which symbol is used to create multiple inheritance?

Dot
Comma
Dollar
None of the above

10. For automatic objects, constructors and destructors are called each time the objects

Enter and leave scope
Inherit parent class
Are constructed
Are destroyed

Results