Question 1 of 25
Hints left: 3
Q1
What does the cerr represent?
Q2
What will be the output of the following C++ code? #include <iostream> using namespace std; int main () { int n; for (n = 5; n > 0; n--) { cout << n; if (n == 3) break; } return 0; }
Q3
Which of the following is correct about remove_extent() function?
Q4
What must be specified when we construct an object of class ostream?
Q5
Which header is need to be used with function objects?
Q6
What is the use of random_shuffle() function of STL algorithm?
Q7
What is the use of polar function?
Q8
What is the use of reset function in bitset?
Q10
Which character is used to separate different arguments?
Q11
What will be the output of the following C++ code? #include <iostream> #include <bitset> using namespace std; int main() { bitset<8> b1(20); cout<<b1.test(1); cout<<b1.test(2); }
Q12
By using which of the following the elements in the associate container can be efficiently accessed?
Q13
Pick the correct statement.
Q14
Which of the following class template are based on arrays?
Q15
What is the output of this C++ program in the "test.txt" file? #include <fstream> using namespace std; int main () { long pos; ofstream outfile; outfile.open ("test.txt"); outfile.write ("This is an apple",16); pos = outfile.tellp(); outfile.seekp (pos - 7); outfile.write (" sam", 4); outfile.close(); return 0; }
Q16
What should present when throwing a object?
Q17
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { int myints[]={ 10, 20, 30, 40, 50 }; vector<int> myvector (4, 99); iter_swap(myints, myvector.begin()); iter_swap(myints + 3,myvector.begin() + 2); for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it) cout << ' ' << *it; return 0; }
Q18
What is a comment in c++?
Q19
What will be the output of the following C++ code? #include <iostream> using namespace std; template <class T, int N> class mysequence { T memblock [N]; public: void setmember (int x, T value); T getmember (int x); }; template <class T, int N> void mysequence<T,N> :: setmember (int x, T value) { memblock[x] = value; } template <class T, int N> T mysequence<T,N> :: getmember (int x) { return memblock[x]; } int main () { mysequence <int, 5> myints; mysequence <double, 5> myfloats; myints.setmember (0, 100); myfloats.setmember (3, 3.1416); cout << myints.getmember(0) << '\n'; cout << myfloats.getmember(3) << '\n'; return 0; }
Q20
What is the correct syntax of constructing any using copy initialization?
Q21
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { int myints[] = {2, 4, 6, 8, 10}; vector<int> v(myints, myints + 5); make_heap (v.begin(),v.end()); cout << v.front() << '\n'; return 0; }
Q22
What happens when no argument is supplied to set() function?
Q23
What is the use of middle parameter in the rotate method?
Q24
Which is the correct syntax of defining a pure virtual function?
Q25
What will be the output of the following C++ code? #include <iostream> using namespace std; #include <cstdlib> #include <exception> void Funct() { cout << "Funct() was called by terminate()." << endl; exit(0); } int main() { try { set_terminate(Funct); throw "Out of memory!"; } catch(int) { cout << "Integer exception raised." << endl; } return 0; }