Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main() { cout<<rank<int[10]>::value; cout<<rank<char[10][10]>::value; cout<<rank<string[10][10][10]>::value; return 0; }
Q2
What is the syntax of defining lambda expression?
Q3
Which of the following is an arithmetic unary functor?
Q4
What does the function objects implement?
Q5
Which operator is used for input stream?
Q6
Which type of relationship is modelled by Inheritance?
Q7
What happens when both of the following C++ programs are compiled and executed? ===== Program 1 ===== #include <iostream> #include <array> using namespace std; int main() { array<int,5> arr1; arr1.fill(5); cout<<get<5>(arr1); return 0; } ===================== ===== Program 2 ===== #include <iostream> #include <array> using namespace std; int main() { array<int,5> arr1; arr1.fill(5); cout<<arr1.at(5); return 0; } =====================
Q8
What are the disadvantages if use return keyword to return error codes?
Q9
What will be the output of the following C++ code? #include <iostream> #include <cctype> using namespace std; int main(int argc, char const *argv[]) { char arr[12] = "Hello World"; for(int i=0;i<12;i++) { cout<<(bool)isalpha(arr[i]); } }
Q10
How many types of output stream classes are there in c++?
Q11
How many categories are available in facets?
Q12
How are many sequences of statements present in c++?
Q13
Which function is used to get the argument of a complex number?
Q14
Where is the derived class is derived from?
Q15
What will be the output of the following C++ code? #include <iostream> using namespace std; template<typename type> type Max(type Var1, type Var2) { return Var1 > Var2 ? Var1:Var2; } int main() { int p; p = Max(100, 200); cout << p << endl; return 0; }
Q16
What will be the output of the following C++ code? #include <iostream> using namespace std; class Car { public: int speed; }; int main() { int Car :: *pSpeed = &Car :: speed; Car c1; c1.speed = 1; cout << c1.speed << endl; c1.*pSpeed = 2; cout << c1.speed << endl; return 0; }
Q17
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int age=5; try { if (age < 0) throw "Positive Number Required"; cout << age << "\n\n"; } catch(const char* Message) { cout << "Error: " << Message; } return 0; }
Q18
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { vector<int> v = {4,2,10,5,1,8}; if (binary_search(v.begin(), v.end(), 4)) cout << "found.\n"; else cout << "not found.\n"; return 0; }
Q19
In which type of storage location are the vector members stored?
Q20
Which is optional in the declaration of vector?
Q21
What will be the output of the following C++ code? #include<iostream> #include<any> #include<string> using namespace std; int main() { string s = "Hello World"; any var(s); cout<<any_cast<char*>(var)<<endl; return 0; }
Q22
What will be the output of the following C++ code? #include <iostream> #include <iterator> #include <list> using namespace std; int main () { list<int> firstlist, secondlist; for (int i = 1; i <= 2; i++) { firstlist.push_back(i); secondlist.push_back(i * 10); } list<int> :: iterator it; it = firstlist.begin(); advance (it, 3); copy (secondlist.begin(), secondlist.end(), inserter(firstlist, it)); for ( it = firstlist.begin(); it != firstlist.end(); ++it ) cout << *it << " "; return 0; }
Q23
Which of the following can serve as random-access iterator?
Q24
What will be the output of the following C++ code? #include <stdio.h> #include <ctype.h> int main () { int i; char str[] = "jobs..."; i = 0; while ( isalnum(str[i] )) i++; printf (" %d\n",i); return 0; }
Q25
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, 30, 20, 10, 10, 20}; vector<int> v(myints, myints + 8); sort (v.begin(), v.end()); vector<int> :: iterator low, up; low = lower_bound (v.begin(), v.end(), 20); up = upper_bound (v.begin(), v.end(), 20); cout << (low - v.begin()) << ' '; cout << (up - v.begin()) << '\n'; return 0; }