Question 1 of 25
Hints left: 3
Q1
Which of the following function(s) is/are used to get the size of the array class?
Q2
What will be the output of the following C++ code? #include <iostream> #include <string> #include<typeinfo> using namespace std; int main( ) { try { string strg1("Test"); string strg2("ing"); strg1.append(strg2, 4, 2); cout << strg1 << endl; } catch (exception &e) { cout << "Caught: " << e.what() << endl; cout << "Type: " << typeid(e).name() << endl; }; return 0; }
Q3
Which of the following is a logical unary functor?
Q4
What is the default type of linkage that is available for identifiers?
Q5
What happens if a pair is not initialized?
Q6
How many items are there in sequence container?
Q7
Which type of list a List sequence container implements?
Q8
What will be the output of the following C++ code? #include <iostream> #include <algorithm> using namespace std; bool myfn(int i, int j) { return i < j; } int main () { int myints[ ] = {3, 7, 2, 5, 6, 4, 9}; cout << *min_element(myints, myints + 7, myfn) << '\n'; cout << *max_element(myints, myints + 7, myfn) << '\n'; return 0; }
Q9
What is a Random number generator?
Q10
What is the full form of vptr?
Q11
Which is used to allocate and deallocate storage for objects during the execution?
Q12
What will happen when we move to try block far away from catch block?
Q13
What will be the output of the following C++ code? #include <iostream> using namespace std; template<typename T> void loopIt(T x) { int count = 3; T val[count]; for (int ii=0; ii < count; ii++) { val[ii] = x++; cout << val[ii] << endl; } }; int main() { float xx = 2.1; loopIt(xx); }
Q14
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; template<typename T> void print_mydata(T output) { cout << output << endl; } int main() { double d = 5.5; string s("Hello World"); print_mydata( d ); print_mydata( s ); return 0; }
Q15
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { /* this is comment* cout << "hello world"; return 0; }
Q16
Which of the following does not support any insertion or deletion?
Q17
What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; for (int i = 1; i <= 5; i++) v.push_back(i); vector<int> :: const_iterator i; for (i = v.begin(); i != v.end(); ++i) cout << *i << " "; cout<<endl; return 0; }
Q18
What is the use of front() function in heap?
Q19
What will be the output of the following C++ code? #include <iostream> using namespace std; void test(int x) { try { if (x > 0) throw x; else throw 'x'; } catch(char) { cout << "Catch a integer and that integer is:" << x; } } int main() { cout << "Testing multiple catches\n:"; test(10); test(0); }
Q20
What is lambda expression in C++?
Q21
How many adaptors support the checked iterators?
Q22
Which are presented in the container adaptors?
Q23
What will be the output of the following C++ code? #include <iostream> using namespace std; class Testpm { public: void m_func1() { cout << "func1\n"; } int m_num; }; void (Testpm :: *pmfn)() = &Testpm :: m_func1; int Testpm :: *pmd = &Testpm :: m_num; int main() { Testpm ATestpm; Testpm *pTestpm = new Testpm; (ATestpm.*pmfn)(); (pTestpm ->* pmfn)(); ATestpm.*pmd = 1; pTestpm ->* pmd = 2; cout << ATestpm.*pmd << endl << pTestpm ->* pmd << endl; }
Q24
What type of Iterator i1 is in the following C++ code snipet? ================ code ================ vector<int>::iterator i1; for (i1=v1.begin();i1!=v1.end();++i1) *i1 = 1; ======================================
Q25
In how many ways we can capture the external variables in the lambda expression?