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. Which of the following is correct about tuple_size?

Returns the number of elements in a tuple
Returns the maximum sized type element
Returns the total number of bits used by the tuple
Returns the sum of non-string values

2. Space taken by bitset bs is less than?

bool bs[N]
vector bs(N)
Both A and B
None of the above

3. The friend functions and the member functions of a friend class can directly access the______________ data.

Private and protected
Private and public
Protected and public
Private, protected and public

4. What will be the output of the following program?

        
Note:Includes all required header files
using namespace std;
    int gcd (int a, int b)
    {
        int temp;
        while (b != 0) 
        {
            temp = a % b;
            a = b;
            b = temp;
        }
        return(a);
    }
    int main ()
    {
        int x = 7, y = 13;
        cout << gcd(x, y);
        return(0);
    } 

7
13
91
1

5. ___________ word is used to ignore the unpacking of some elements of a tuple.

stop
ignore
cancel
remain

6. Functions are declared with a _________ keyword in base class.

init
self
virtual
extend

7. Which of the things does not require instantiation?

Functions
Non virtual member function
Member class
All of the above

8. What will be the output of the following program?

        
Note:Includes all required header files

using namespace std; 

   int main ()
   {
       int find[5];
       int * p;
       p = find;  *p = 1;
       p++;  *p = 2;
       p = &find[2];  *p = 3;
       p = find + 3;  *p = 4;
       p = find;  *(p + 4) = 5;
       for (int n = 0; n < 5; n++)
           cout << find[n] << ",";
       return 0;
   }    

1,2,3,4,5,
12345
compile error
runtime error

9. What is the output of this program?

        
Note:Includes all required header files

    using namespace std;
    void fun(int p, int q)
    {
        p = 20;
        q = 10;
    }
    int main()
    {
        int p = 10;
        fun(p, p);
        cout << p;
        return 0;
    }    

10
20
compile time error
none of the mentioned

10. Which of the following provides a reuse mechanism?

Abstraction
Inheritance
Dynamic binding
Encapsulation

Results