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 statement is correct?

A referenced has to be de-referenced to access a value.
A referenced does not need to be de-referenced to access a value.
A referenced has to be double de-referenced to access a value.
Whether a reference should be de-referenced or not depends on the type of the reference.

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

conditional operator
ternary operator
scope operator
None of the mentioned

3. What will be the output of this program?

#include <iostream>
using namespace std;

int main()
{
    int p = 10, q = 20;
    int *ptr = & p;
    int &ref = q;

    *ptr++;
     ref++;    

    cout<< p << " " << q;
    return 0; 
}

The program will print the output 10 20.
The program will print the output 10 21.
The program will print the output 11 20.
The program will print the output 11 21.

4. Assume that the random number generating function - rand( ), returns an integer between 0 and 10000 (both inclusive). If you want to simulate the throwing of a die using this random function, use the expression

rand ( ) % 6
rand ( ) % 6 + 1
rand ( ) % 5 + 1
None of the above

5. bitset::hash() used for?

Convert hash value to unsigned long
Returns hash value based on the provided bitset.
Reports the size of the hash.
Reset hash value to zero.

6. Which of the following statement is correct?

Only one parameter of a function can be a default parameter.
Minimum one parameter of a function must be a default parameter.
All the parameters of a function can be default parameters.
No parameter of a function can be default.

7. Inheritance allow in C++ Program?

Class Re-usability
Creating a hierarchy of classes
Extendibility
All of the above

8. Destructor has a same name as the constructor and it is preceded by?

!
?
~
$

9. Which is the correct statement about pure virtual functions?

They should be defined inside a base class
Pure keyword should be used to declare a pure virtual function
Pure virtual function is implemented in derived classes
Pure virtual function cannot implemented in derived classes

10. How many ways of reusing are there in class hierarchy?

1
3
4
2

Results