C++ LEVEL TEST
About C++ Test
  • There are 10 questions in this C++ test.
  • They cover all levels from basic to advanced in a random order.
  • Some of the questions are easier, some are more difficult. Don’t worry if you don’t know the answer!
  • Don’t use any books or websites to help you – the idea is to find your natural level!

Which of the following is the correct syntax of including a "userdefined" header files in C++?




Which of the following is not a type of Constructor in C++?




Which of the following is correct about this pointer in C++?




Which of the following is used to terminate the function declaration in C++?




What is meant by a polymorphism in C++?




Which of the following constructors are provided by the C++ compiler if not defined in a class?




What is the output of the following program?

#include <iostream>
using namespace std;
  
int main()
{
    char v = 'a';
  
    switch (v) {
    case 'A':
        cout << "Selection is A";
        break;
    case 'B':
        cout << "Selection is B";
        break;
    case 'C':
        cout << "Selection is C";
        break;
    default:
        cout << "Selection other than A, B and C";
        break;
    }
	
    return 0;
}



What is the output of the following program?

int main()
{
    for (int i = 1; i < 10; i++) {
 
        if (i == 5)
            continue;
        cout << i << " ";
    }
    return 0;
}



What is the output of the following program?

#include <iostream>
using namespace std;

void swap(int* i, int* j)
{
    int temp = *i;
    *i = *j;
    *j = temp;
}
 
int main(void)
{
    int n1 = 2, n2 = 5;
 
    swap(&n1, &n2);
 
    cout <<"n1: " <<n1 <<" n2: " <<n2 <<endl;
    
    return 0;
}



What is the output of the following program?

#include <iostream>
#include <algorithm> int main() { int arr[] = { 1, 2, 3, 4, 5 }; int mul = 5; std::for_each(arr, arr + sizeof(arr) / sizeof(int), [](int x) { x = x*mul; }); std::for_each(arr, arr + sizeof(arr) / sizeof(int), [](int x) { std::cout <<x<<" "; }); std::cout << std::endl; }