Question 1 of 25
Hints left: 3
Q1
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; }
Q2
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; }
Q3
What are Random-access Iterators?
Q4
What is the use of tuple_cat() function?
Q5
Which one is used to refer to program elements in any translation units?
Q6
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; }
Q7
Which function is used to print the maximum element from Valarray?
Q8
What can be improved by formatting the source code?
Q9
When will the cin can start processing of input?
Q10
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; }
Q11
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; }
Q12
How many parameters are available in srand function?
Q13
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; }
Q14
What is Valarray in C++?
Q15
To what type of object does the container can be instantiated?
Q16
How many types of class relationships are there?
Q17
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; }
Q18
Which of the header file is used to implement algorithms provided by C++ STL?
Q19
How many sets of requirements are need in designing a container?
Q20
What is the difference between begin() and cbegin() in vectors?
Q21
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; } }
Q22
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; }
Q23
What are Distributions in C++?
Q24
What kind of library is Standard Template Library?
Q25
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; }