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. A void pointer cannot point to which of these?

Methods in c++
Class member in c++
Both A & B
None of the above

2. What is the output of this program?

#include <iostream>
using namespace std;

int main()
{
    try
    {
       throw 'b';
    }
    catch (int param)
    {
        cout << "Int Exception";
    }
    catch (...)
    {
        cout << "Default Exception";
    }
    cout << "After Exception";
    return 0;
}

Default Exception After Exception
Int Exception After Exception
Int Exception
Default Exception

3. State whether the following statements about the constructor are True or False. i) constructors should be declared in the private section. ii) constructors are invoked automatically when the objects are created.

True,True
True,False
False,True
False,False

4. What will be the output of this program?

         
Note:Includes all required header files
using namespace std;
    int main ()
    {
        int p = 10;
        double q = 1.14;
        
        cout << p + q;
        endl (cout);
        return 0;
    }

10
1.14
11.14
All of the above

5. Reusability of the code can be achieved in CPP through ______ .

Polymorphism
Encapsulation
Inheritance
Both A and C

6. What is the output of this program?

#include <iostream>
using namespace std;
class course
{  
  int member;
  public : int* lfc()
  { 
    return & member; 
  }
};
main()
{
course s;
int *ptr=s.lfc();
return 0;
}  

This code is good to go
This code may result in undesirable conditions
This code will generate error
This code violates encapsulation

7. A pure virtual function is specified by placing?

-1
0
1
infinite

8. What is the size of empty class?

0
2
4
1

9. Which of the following is true about the following program

         
Note:Includes all required header files
using namespace std;
    int main () 
    {
            char i;
        streambuf * p;
        ofstream of ("find.txt");
        pbuf = of.rdbuf();
        do {
            i = cin.get();
            p -> sputc(i);
        } while (i != '.');
        of.close();
         return 0;
    }

insertion operator
$ symbol
dot operator
none of the mentioned

10. How many types of templates are there in c++?

1
2
3
4

Results