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. What is the return value of f(p, p) if the value of p is initialized to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value.

#include <iostream>
using namespace std;

int LFC(int &x, int c)
{
    c  = c - 1;
    if (c == 0) return 1;
    x = x + 1;
    return LFC(x, c) * x;
}
int main()
{
    int p = 5;
    printf("%d", LFC(p, p));
}

3024
6561
55440
161051

2. 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

3. What will be the order of execution of base class constructors in the following method of inheritance.class a: public b, public c {...};

b(); c(); a();
c(); b(); a();
a(); b(); c();
b(); a(); c();

4. We can make an instance of an abstract super class

TRUE
FALSE
Can be true and false
Can not say

5. Catch-all handlers uses which operators in c++?

String operators
Ternary operators
Ellipses operators
Unary operators

6. How many type of recursion there?

1
2
3
4

7. 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.

8. What will be the output of this program?

        
Note:Includes all required header files
 using namespace std;
    int main () 
  
{
    FILE *fp;
    char x[1024];
    fp = fopen("find.txt", "r");  // "ayushjain and prateek" 
    x[0] = getc(fp);              
    fseek(fp, 0, SEEK_END);        
    fseek(fp, -7L, SEEK_CUR);      
    fgets(x, 6, fp);             
    puts(x);                     
    return 0;
} 

ayushj
yushja
ayushja
prate

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

#include <iostream>
using namespace std;
int main () 
{
    try
    {
        throw 10;
    }
    catch (int LFC)
    {
        cout << "An exception occurred " << LFC << endl;
    }
    return 0;
}

10
An exception
Error
An exception occurred 10

10. What is size of generic pointer in c?

0
1
2
Null

Results