Question 1 of 25
Hints left: 3
Q1
What is the full form of vptr?
Q2
Which type of list a List sequence container implements?
Q3
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; }
Q4
What is the use of front() function in heap?
Q5
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); }
Q6
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; }
Q7
What will happen when we move to try block far away from catch block?
Q8
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; }
Q9
What is a Random number generator?
Q10
Which are presented in the container adaptors?
Q11
What happens if a pair is not initialized?
Q12
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; ======================================
Q13
Which of the following is a logical unary functor?
Q14
What is lambda expression in C++?
Q15
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); }
Q16
How many adaptors support the checked iterators?
Q17
What is the default type of linkage that is available for identifiers?
Q18
In how many ways we can capture the external variables in the lambda expression?
Q19
Which of the following function(s) is/are used to get the size of the array class?
Q20
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; }
Q21
How many items are there in sequence container?
Q22
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; }
Q23
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; }
Q24
Which is used to allocate and deallocate storage for objects during the execution?
Q25
Which of the following does not support any insertion or deletion?