Question 1 of 25
Hints left: 3
Q1
Which of the following function is used to initialize a tuple?
Q2
What will be the output of the following C++ code? #include <iostream> using namespace std; int main( ) { char line[100]; cin.getline( line, 100, 't' ); cout << line; return 0; }
Q3
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; bool mypredicate (int i, int j) { return (i == j); } int main () { vector<int> myvector; for (int i = 1; i < 6; i++) myvector.push_back (i * 10); int myints[] = {10, 20, 30, 40, 1024}; pair<vector<int> :: iterator, int*> mypair; mypair = mismatch (myvector.begin(), myvector.end(), myints); cout << *mypair.first<<'\n'; cout << *mypair.second << '\n'; ++mypair.first; ++mypair.second; return 0; }
Q4
What is the use of clog?
Q5
What is the use of the 'finally' keyword?
Q6
How many types of inheritance are there in c++?
Q7
Which of the following header file is required to use in-bulit functors of C++?
Q8
Which mathematics library is used for vector manipulation in c++?
Q9
What will be the output of the following C++ code? #include <iostream> using namespace std; template <typename T = float, int count = 3> T multIt(T x) { for(int ii = 0; ii < count; ii++) { x = x * x; } return x; }; int main() { float xx = 2.1; cout << xx << ": " << multIt<>(xx) << endl; }
Q10
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[27] = "abcdefghijklmnopqrstuvwxyz"; for(int i=0;i<27;i++) { cout<<(bool)isxdigit(arr[i]); } }
Q11
What will be the output of the following C++ code? #include <cstdlib> #include <iostream> using namespace std; int main() { int ran = rand(); cout << ran << endl; }
Q12
What will be the output of the following C++ code? #include <iostream> using namespace std; int main () { int n; n = -77; cout.width(4); cout << internal << n << endl; return 0; }
Q13
What will be the output of the following C++ code? #include <iostream> using namespace std; template <class type> class Test { public: Test() { }; ~Test() { }; type Funct1(type Var1) { return Var1; } type Funct2(type Var2) { return Var2; } }; int main() { Test<int> Var1; Test<double> Var2; cout << Var1.Funct1(200); cout << Var2.Funct2(3.123); return 0; }
Q14
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { vector<int> first (5, 10); vector<int> second (5, 33); vector<int>::iterator it; swap_ranges(first.begin() + 1, first.end() - 1, second.begin()); cout << " first contains:"; for (it = first.begin(); it != first.end(); ++it) cout << " " << *it; cout << "\nsecond contains:"; for (it = second.begin(); it != second.end(); ++it) cout << " " << *it; return 0; }
Q15
What will be the output of the following C++ code? #include <vector> #include <iostream> #include <typeinfo> #include <stdexcept> using namespace std; int main() { vector<int> vec; vec.push_back(10); int i = vec[100]; try { i = vec[0]; cout << i << endl; } catch (exception &e) { cout << "Caught: " << e.what( ) << endl; cout << "Type: " << typeid( e ).name( ) << endl; } catch (...) { cout << "Unknown exception: " << endl; } return 0; }
Q16
What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; for (int i = 1; i <= 5; i++) v.push_back(i); cout<<v.size(); cout<<endl<<v.capacity(); return 0; }
Q17
What is the correct syntax of constructing any using parameterized constructor?
Q18
Subsequent elements are moved in terms of . . . . . . . . when an element in inserted in vector?
Q19
What will be the output of the following C++ code? #include<iostream> using namespace std; int main() { int a = 5; auto check = [=]() { a = 10; }; check(); cout<<"Value of a: "<<a<<endl; return 0; }
Q20
Which of the following operator is used to capture all the external variable by value?
Q21
What kind of object is modifying sequence algorithm?
Q22
What will be the output of the following C++ code? #include <iostream> #include <memory> #include <string> using namespace std; int main () { pair <string*, ptrdiff_t> result = get_temporary_buffer<string>(3); if (result.second > 0) { uninitialized_fill ( result.first, result.first + result.second, "Hai" ); for (int i=0; i<result.second; i++) cout << result.first[i] ; return_temporary_buffer(result.first); } return 0; }
Q23
Which of the following is correct about shift() and cshift()? 1. shift() makes some values of Valarray equal to 0 after shifting by a non-zero number 2. cshift() makes some values of Valarray equal to 0 after shifting by a non-zero number
Q24
How many kind of operation can be applied to transform method in c++?
Q25
Which header file is used to create the pseudo random generator?