Question 1 of 25
Hints left: 3
Q1
To use internal linkage we have to use which keyword?
Q2
What do we return if we use simple array on a internal container?
Q3
Which function is used to optimize the space in vector?
Q4
What will be the output of the following C++ code? #include <stdio.h> int main () { freopen ("myfile.txt", "w", stdout); printf ("This sentence is redirected to a file"); fclose (stdout); return 0; }
Q5
What will be the output of the following C++ code? #include <iostream> #include <limits> using namespace std; int main( ) { cout << numeric_limits<short int> :: max() << endl; }
Q6
Where does a cin stops it extraction of data?
Q7
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; template<class T> T func(T a) { cout<<a; return a; } int func(int a) { cout<<a; } int main(int argc, char const *argv[]) { int a = 5; int b = func(a); float c = func(5.5); return 0; }
Q8
What is meant by the template parameter?
Q9
What is the correct syntax for declaring an allocator?
Q10
Which header file is required to use any container?
Q11
What will be the output of the following C++ code? #include <iostream> #include <iterator> #include <list> using namespace std; int main () { list<int> mylist; for (int i = 0; i < 10; i++) mylist.push_back (i * 10); list<int> :: iterator it = mylist.begin(); advance (it, 5); cout << *it << endl; return 0; }
Q12
What will be the output of the following C++ code? #include <iostream> #include <set> using namespace std; int main () { multiset<int> mymultiset; for (int i = 0; i < 5; i++) mymultiset.insert(i); multiset<int> :: key_compare mycomp = mymultiset.key_comp(); int highest = *mymultiset.rbegin(); multiset<int> :: iterator it = mymultiset.begin(); do { cout << ' ' << *it; } while (mycomp(*it++, highest)); return 0; }
Q13
What is Pseudo-random number engines?
Q14
What will be the output of the following C++ code? #include <iostream> using namespace std; class Foo { public: Foo(int i = 0){ _i = i;} void f() { cout << "Executed"<<endl; } private: int _i; }; int main() { Foo *p = 0; p -> f(); }
Q15
How can the member functions in the container be accessed?
Q16
What type can be used to replace templates from this function? template<class T, class U> T func(T a, T b, U c) { if(c == '+' || c){ return a+b; } else if(c == '-' || !c){ return a-b; } }
Q17
How many parameters are available in the function setbuf?
Q18
What is the use of count() function in bitset?
Q19
What is the importance of mutable keyword?
Q20
Members of which access specifiers are not inherited?
Q21
Which of the header file must be included to use stringstream?
Q22
Why is it expensive to use objects for the exception?
Q23
What will be the output of the following C++ code? #include <iostream> #include<string.h> using namespace std; int main() { try { char *p; strcpy(p, "How r u"); } catch(const exception& er) { } }
Q24
What will be the output of the following C++ code? #include <iostream> #include <typeinfo> using namespace std; int main () { int * a; int b; a = 0; b = 0; if (typeid(a) != typeid(b)) { cout << typeid(a).name(); cout << typeid(b).name(); } return 0; }
Q25
What is the use of the indentation in c++?