Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C++ code? #include <iostream> #include <array> using namespace std; int main(int argc, char const *argv[]) { array<int,5> arr1; arr1.fill(5); cout<<get<5>(arr1); return 0; }
Q2
What will be the output of the following C++ code? #include <iostream> #include <bitset> using namespace std; int main() { bitset<8> b1(15); cout<<b1; }
Q3
What will be the output of the following C++ code? #include <iostream> #include <deque> using namespace std; int main () { unsigned int i; deque<int> mydeque; deque<int> :: iterator it; mydeque.push_back ( 100 ); mydeque.push_back ( 200 ); mydeque.push_back ( 300 ); for (it = mydeque.begin(); it != mydeque.end(); ++it) mydeque.clear(); cout << ' ' << *it; }
Q4
Which operator is used to deallocate the memory?
Q5
Which keyword is used for the template?
Q6
What are Templates in C++?
Q7
Which header file is required to use accumulate() function?
Q8
What will be the output of the following C++ code? #include <iostream> #include <map> using namespace std; int main () { map<char, int> mymap; map<char, int> :: iterator it; mymap['b'] = 100; mymap['a'] = 200; mymap['c'] = 300; for (map<char, int> :: iterator it = mymap.begin(); it != mymap.end(); ++it) cout << it -> first << " => " << it -> second << '\n'; return 0; }
Q9
What is most suitable for returning the logical errors in the program?
Q10
How the sequence of objects can be accessed?
Q11
What is subtract_with_carry_engine?
Q12
What will be the output of the following C++ code? #include <iostream> #include <stdarg.h> using namespace std; float avg( int Count, ... ) { va_list Numbers; va_start(Numbers, Count); int Sum = 0; for (int i = 0; i < Count; ++i) Sum += va_arg(Numbers, int); va_end(Numbers); return (Sum/Count); } int main() { float Average = avg(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); cout << Average; return 0; }
Q13
Which of the following gives the name of the program if the second parameter to the main fucntion is char **argv?
Q14
What will be the output of the following C++ code? #include <iostream> #include <string> #include <tuple> using namespace std; int main() { tuple <int, char, string> tp; tp = make_tuple(4, '1', "Hello"); cout<<tuple_size<decltype(tp)>::value; return 0; }
Q15
Pick out the correct objects about the instantiation of output stream.
Q16
What is the default value of a bitset?
Q17
How many types of guarantees are there in exception class can have?
Q18
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; bool myfunction (int i,int j) { return (i < j); } int main () { int myints[] = {9, 8, 7, 6}; vector<int> myvector (myints, myints + 4); partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end()); partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end(), myfunction); for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it) cout << ' ' << *it; return 0; }
Q19
What will be the output of the following C++ code? #include <iostream> #include <complex> using namespace std; int main() { complex <double> cn(3.0, 4.0); cout<<sin(cn)<<endl; return 0; }
Q20
What happens if try catch block is not used?
Q21
How many types of comments are there in c++?
Q22
What will be the output of the following C++ code? #include <iostream> #include <limits> using namespace std; int main( ) { cout << numeric_limits<float> :: digits10 << endl; cout << numeric_limits<double> :: digits10 << endl; float f = 99999999; cout.precision ( 10 ); cout << f << endl; }
Q23
Which type of program is recommended to include in try block?
Q24
What is the difference between normal function and template function?
Q25
What will be the output of the following C++ code? #include <stdio.h> #include <ctype.h> int main () { int i = 0; char str[] = "Steve Jobs\n"; char c; while (str[i]) { c = str[i]; if (islower(c)) c = toupper(c); putchar (c); i++; } return 0; }