Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C++ code?
Q2
Pick out the correct statement.
Q3
When exceptions are used?
Q4
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; }
Q5
Pick out the correct statement for error handling alternatives.
Q6
Choose the correct formatted code.
Q7
Which operator is used to take AND of two bitset variables?
Q8
Which is used to iterate over container?
Q9
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; }
Q10
Which function is used to swap two Valarray?
Q11
Which of the following is correct?
Q12
Templates simulate which of the following feature?
Q13
What does inheritance allow you to do?
Q14
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; }
Q15
What will the monetary facet will do?
Q16
Which is used for manually writing lookup table?
Q17
Pick the correct statement.
Q18
What kind of errors do checked iterators detect?
Q19
Which of the following is correct about extent() function?
Q20
Which of te following is a built-in example of functors in C++?
Q21
What will be the output of the following C++ code? #include<iostream> #include<iterator> #include<vector> using namespace std; int main() { vector<int> ar = { 1, 2, 3, 4, 5 }; vector<int>::iterator ptr = ar.begin(); advance(ptr, 2); cout << *ptr << endl; return 0; }
Q22
Composition is a . . . . . . . . type of Association relationship.
Q23
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; }
Q24
What will be the output of the following C++ code? #include <iostream> using namespace std; template <class T> inline T square(T x) { T result; result = x * x; return result; }; template <> string square<string>(string ss) { return (ss+ss); }; int main() { int i = 4, ii; string ww("A"); ii = square<int>(i); cout << i << ii; cout << square<string>(ww) << endl; }
Q25
What is the default random engine?