Vidyalelo
C++ Programming · all questions

C++ miscellaneous
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

1,008

Questions

21/51

Page

Pick an option on a question to see the right answer and solution.

What kind of errors do checked iterators detect?

Select an option to see the answer and solution.

Pick out the correct statement.

Select an option to see the answer and solution.

What will the monetary facet will do?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T, class U = char>
class A
{
	T a;
	U b;
    public:
	A(T a_val, char b_val = '$'){
		this->a = a_val;
		this->b = b_val;
	}
	void print(){
		cout<<a<<' '<<b<<endl;
	}
};
 
int main(int argc, char const *argv[])
{
	A <int, int> a1(5,10);
	A <int> a2(5);
	A <float> a3(10.0);
	return 0;
}

Select an option to see the answer and solution.

Which is used for manually writing lookup table?

Select an option to see the answer and solution.

Which function is used to swap two Valarray?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include<iostream>
#include<any>
using namespace std;
int main()
{
	float val = 5.5;
	any var(val);
	if(var.has_value())
        {
            cout<<"Var is not Empty\n";
        }
        else
        {
            cout<<"Var is Empty\n";
        }
	return 0;
}

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include<iostream>
using namespace std;
class Add
{
	int x;
   public:
	Add(int x){
		this->x = x;
	}
	int operator()(int a){
		return x+a;
	}
};
int main()
{
	Add add_5(5);
	int a = 5;
	cout<<add_5(a);
	return 0;
}

Select an option to see the answer and solution.

What does inheritance allow you to do?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main(void)
{
    const char *one = "Test";
    cout << one << endl;
    const char *two = one;
    cout << two << endl;
    return 0;
}

Select an option to see the answer and solution.

Which of the following is correct about extent() function?

Select an option to see the answer and solution.

Pick the correct statement.

Select an option to see the answer and solution.

What will be the output of the following C++ code?

Select an option to see the answer and solution.

Choose the correct formatted code.

Select an option to see the answer and solution.

Composition is a . . . . . . . . type of Association relationship.

Select an option to see the answer and solution.

Templates simulate which of the following feature?

Select an option to see the answer and solution.

Pick out the correct statement for error handling alternatives.

Select an option to see the answer and solution.

What is the default random engine?

Select an option to see the answer and solution.

Which operator is used to take AND of two bitset variables?

Select an option to see the answer and solution.

Which is used to iterate over container?

Select an option to see the answer and solution.