Question 1 of 25
Hints left: 3
Q1
Where are standard exception classes grouped?
Q2
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] << " "; } }
Q3
Which header file is used for Iterators?
Q4
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; }
Q5
How many components STL has?
Q6
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(); }
Q7
Pick out the correct library in the following choices.
Q8
Pick out the wrong header file.
Q9
What is the type of the first item in the heap?
Q10
What is the use of make_heap in the heap operation?
Q11
What are Unordered Associative Containers?
Q12
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; }
Q13
How does the limits.h header file can be represented in C++?
Q14
In how many categories, containers are divided?
Q15
Pick out parameter for rehash method in unordered_set in c++?
Q16
How many parameters are used in frexp function?
Q17
Which is best for coding the standard library for 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 wrong header file about strings.
Q20
What are Container Adaptors?
Q21
Which header file is used to declare the standard exception?
Q22
What are the predefined exceptions in c++?
Q23
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; }
Q24
What is the use of <exception> header
Q25
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; }