Question 1 of 25
Hints left: 3
Q1
What is the use of clog?
Q2
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; }
Q3
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; }
Q4
What kind of object is modifying sequence algorithm?
Q5
Subsequent elements are moved in terms of . . . . . . . . when an element in inserted in vector?
Q6
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; }
Q7
How many types of inheritance are there in c++?
Q8
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; }
Q9
Which of the following header file is required to use in-bulit functors of C++?
Q10
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; }
Q11
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; }
Q12
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
Q13
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; }
Q14
What is the use of the 'finally' keyword?
Q15
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; }
Q16
Which of the following function is used to initialize a tuple?
Q17
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; }
Q18
Which mathematics library is used for vector manipulation in c++?
Q19
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; }
Q20
Which header file is used to create the pseudo random generator?
Q21
Which of the following operator is used to capture all the external variable by value?
Q22
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]); } }
Q23
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; }
Q24
How many kind of operation can be applied to transform method in c++?
Q25
What is the correct syntax of constructing any using parameterized constructor?