Question 1 of 25
Hints left: 3
Q1
Pick out the wrong header file.
Q2
What will be the output of the following C++ code? #include <list> #include <string> #include <iostream> using namespace std ; typedef list<string> LISTSTR; int main() { LISTSTR :: iterator i; LISTSTR test; test.insert(test.end(), "one"); test.insert(test.end(), "two"); LISTSTR test2(test); LISTSTR test3(3, "three"); LISTSTR test4(++test3.begin(), test3.end()); cout << "test:"; for (i = test.begin(); i != test.end(); ++i) cout << " " << *i << endl; cout << "test:"; for (i = test2.begin(); i != test2.end(); ++i) cout << " " << *i << endl; cout << "test:"; for (i = test3.begin(); i != test3.end(); ++i) cout << " " << *i << endl; cout << "test:"; for (i = test4.begin(); i != test4.end(); ++i) cout << " " << *i << endl; }
Q3
How many components STL has?
Q4
Where are standard exception classes grouped?
Q5
Pick out parameter for rehash method in unordered_set in c++?
Q6
What are Container Adaptors?
Q7
What is the use of make_heap in the heap operation?
Q8
What will be the output of the following C++ code? #include <iostream> #include <list> #include <queue> using namespace std; int main() { queue<char> q; q.push('a'); q.push('b'); q.push('c'); cout << q.front(); q.pop(); cout << q.front(); q.pop(); cout << q.front(); q.pop(); }
Q9
Which header file is used for Iterators?
Q10
How many parameters are used in frexp function?
Q11
What will be the output of the following C++ code? #include <stdio.h> #include <stdlib.h> int main () { char s[] = "365.24 29.53"; char* p; double d1, d2; d1 = strtod (s, &p); d2 = strtod (p, NULL); printf ("%.2f\n", d1/d2); return 0; }
Q12
What is the use of <exception> header
Q13
What is the type of the first item in the heap?
Q14
How does the limits.h header file can be represented in C++?
Q15
What are Unordered Associative Containers?
Q16
Which header file is used to declare the standard exception?
Q17
What are the predefined exceptions in c++?
Q18
What will be the output of the following C++ code? #include <iostream> #include <exception> using namespace std; class myexc: public exception { virtual const char* what() const throw() { return "My exception"; } } myex; int main () { try { throw myex; } catch (exception& e) { cout << e.what() << endl; } return 0; }
Q19
Pick out the correct library in the following choices.
Q20
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { vector<int> myvector; for (int i = 1; i < 6; ++i) myvector.push_back(i); reverse(myvector.begin(), myvector.end()); for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it) cout << ' ' << *it; return 0; }
Q21
In how many categories, containers are divided?
Q22
What will be the output of the following C++ code? #include <stdio.h> #include <math.h> int main () { printf ("The value of -3.1416 is %lf\n", fabs (-3.1416)); return 0; }
Q23
Pick out the wrong header file about strings.
Q24
Which is best for coding the standard library for c++?
Q25
What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; v.assign( 10, 42 ); for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } }