Question 1 of 25
Hints left: 3
Q1
Which function is used to access the first element of an array class?
Q2
What are the design requirements for building a container from the sratch?
Q3
How many tests are available in read and write operations?
Q4
What is meant by exception specification?
Q5
What is the use of sort_heap() function in heap?
Q6
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 = {1,2,3,4,5}; array<int, 5> arr2 = {6,7,8,9,10}; arr1.swap(arr2); for(int i=0;i<5;i++) cout<<arr1[i]<<" "; cout<<endl; for(int i=0;i<5;i++) cout<<arr2[i]<<" "; cout<<endl; return 0; }
Q7
What is the use of sum() function in Valarray?
Q8
Which alternative can replace the throw statement?
Q9
How the list differs from vectors?
Q10
What should be used to point to a static class member?
Q11
What will be the output of the following C++ code? #include <iostream> #include <utility> using namespace std; int main () { pair p(1,2); cout<<"Pair(first,second) = ("<<p.first<<","<<p.second<<")\n"; return 0; }
Q12
What will be the output of the following C++ code? #include <iostream> #include <stack> using namespace std; int main () { stack<int> myints; cout << (int) myints.size(); for (int i = 0; i < 5; i++) myints.push(i); cout << (int) myints.size() << endl; return 0; }
Q13
What will the max function in the numeric limit will return for type float?
Q14
What will be the output of the following C++ code? #include <iostream> using namespace std; template<typename T>class clsTemplate { public: T value; clsTemplate(T i) { this->value = i; } void test() { cout << value << endl; } }; class clsChild : public clsTemplate<char> { public: clsChild(): clsTemplate<char>( 0 ) { } clsChild(char c): clsTemplate<char>( c ) { } void test2() { test(); } }; int main() { clsTemplate <int> a( 42 ); clsChild b( 'A' ); a.test(); b.test(); return 0; }
Q15
What will be the output of the following C++ code? #include <iostream> #include <functional> #include <numeric> using namespace std; int myaccumulator (int x, int y) { return x - y; } int myproduct (int x, int y) { return x + y; } int main () { int a = 100; int series1[] = {10, 20, 30}; int series2[] = {1, 2, 3}; cout << inner_product(series1, series1 + 3, series2, a ,myaccumulator, myproduct); cout << endl; return 0; }
Q16
What will be the output of the following C++ code? #include <iostream> #include <set> using namespace std; int main () { set<int> myset; myset.insert(20); myset.insert(30); myset.insert(10); while (!myset.empty()) { cout << ' ' << *myset.begin(); myset.erase(myset.begin()); } cout << '\n'; return 0; }
Q17
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> tp1; tp1 = make_tuple(6, 'a', "Hello"); int x; string y; tie(x,ignore,y) = tp1; cout<<"x: "<<x<<"\ny: "<<y<<endl; return 0; }
Q18
Which of the following operator is used to capture all the external variable by reference?
Q19
What will be the output of the following C++ code? #include<iostream> #include<any> using namespace std; int main() { float val = 5.5; any var(val); cout<<var<<endl; char c = 'a'; var.emplace<char>(c); cout<<var<<endl; return 0; }
Q20
What will happen if an exception that is thrown may cause a whole load of objects to go out of scope?
Q21
What type of algorithm is not available in creating our own STL style algorithms?
Q22
What will be the output of the following C++ code? #include<iostream> using namespace std; class Print { public: void operator()(int a){ cout<<a<<endl; } }; int main() { Print print; print(5); return 0; }
Q23
Which is used to throw a exception?
Q24
Which operator is used as not operator in bitset?
Q25
Which of the following is correct about Valarray?