Question 1 of 25
Hints left: 3
Q1
Which is the correct syntax of defining a pure virtual function?
Q3
What is the use of random_shuffle() function of STL algorithm?
Q4
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; }
Q5
What is the correct syntax of constructing any using copy initialization?
Q6
What is the use of polar function?
Q7
Which header is need to be used with function objects?
Q8
What should present when throwing a object?
Q9
What is a comment in c++?
Q10
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); }
Q11
Which of the following class template are based on arrays?
Q12
What happens when no argument is supplied to set() function?
Q13
By using which of the following the elements in the associate container can be efficiently accessed?
Q14
Which of the following is correct about remove_extent() function?
Q15
What does the cerr represent?
Q16
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; }
Q17
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; }
Q18
What is the use of middle parameter in the rotate method?
Q19
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; }
Q20
Which character is used to separate different arguments?
Q21
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; }
Q22
What is the use of reset function in bitset?
Q23
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; }
Q24
Pick the correct statement.
Q25
What must be specified when we construct an object of class ostream?