Question 1 of 25
Hints left: 3
Q1
Which of the header file is used to implement algorithms provided by C++ STL?
Q2
What will be the output of the following C++ code? #include <cstdlib> #include <ctime> #include <iostream> using namespace std; int main() { srand((unsigned)time(0)); int ran; for (int i = 0; i < 2; i++) { ran = (rand() % 10) + 1; cout << ran; } }
Q3
What is the use of tuple_cat() function?
Q4
To what type of object does the container can be instantiated?
Q5
What is the difference between begin() and cbegin() in vectors?
Q6
Which function is used to print the maximum element from Valarray?
Q7
How many sets of requirements are need in designing a container?
Q8
What are Distributions in C++?
Q9
When will the cin can start processing of input?
Q10
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int var = -12; try { cout<<"Inside try\n"; if (var < 0) { throw var; cout<<"After throw\n"; } } catch (char var ) { cout<<"Exception Caught\n"; } cout<<"After catch\n"; return 0; }
Q11
What kind of library is Standard Template Library?
Q12
What can be improved by formatting the source code?
Q13
What are Random-access Iterators?
Q14
How many parameters are available in srand function?
Q15
What will be the output of the following C++ code? #include <iostream> #include <functional> #include <numeric> using namespace std; int myfunction (int x, int y) { return x + 2 * y; } struct myclass { int operator()(int x, int y) { return x + 3 * y; } } myobject; int main () { int init = 100; int numbers[] = {10, 20, 30}; cout << accumulate (numbers, numbers + 3, init, minus<int>() ); cout << endl; return 0; }
Q16
What will be the output of the following C++ code? #include <iostream> #include <exception> using namespace std; int main () { try { int* myarray = new int[1000]; cout << "allocated"; } catch (exception& e) { cout << "Standard exception: " << e.what() << endl; } return 0; }
Q17
Which one is used to refer to program elements in any translation units?
Q18
What will be the output of the following C++ code? #include <iostream> #include <functional> #include <vector> #include <algorithm> #include <string> using namespace std; int main () { vector <string*> numbers; numbers.push_back ( new string ("one") ); numbers.push_back ( new string ("two") ); numbers.push_back ( new string ("three") ); vector <int> lengths ( numbers.size() ); transform (numbers.begin(), numbers.end(), lengths.begin(), mem_fun(&string :: length)); for (int i = 0; i < 3; i++) { cout << lengths[i]; } return 0; }
Q19
What will be the output of the following C++ code? #include <stdio.h> #include <ctype.h> int main () { int i = 0; char str[] = "C"; while (str[i]) { if (isalpha(str[i])) printf ("alphabetic"); else printf ("not alphabetic"); i++; } return 0; }
Q20
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main() { cout<<rank<remove_extent<string[10][20]>::type>::value; cout<<rank<remove_extent<string[10][20][30]>::type>::value; return 0; }
Q21
How many types of class relationships are there?
Q22
What will be the output of the following C++ code? #include <iostream> using namespace std; template <class T> T max (T& a, T& b) { return (a>b?a:b); } int main () { int i = 5, j = 6, k; long l = 10, m = 5, n; k = max(i, j); n = max(l, m); cout << k << endl; cout << n << endl; return 0; }
Q23
What will be the output of the following C++ code? #include <iostream> #include <queue> using namespace std; int main () { queue<int> myqueue; myqueue.push(12); myqueue.push(75); myqueue.back() -= myqueue.front(); cout << myqueue.back() << endl; return 0; }
Q24
What is Valarray in C++?
Q25
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main() { cout<<is_same<int,char>::value; cout<<is_same<char[10], char[10]>::value; cout<<is_same<char*[10], string>::value; return 0; }