Question 1 of 25
Hints left: 3
Q1
Which of the following is correct to interpret Hello World as a single argument? 1. $ ./output 'Hello World' 2. $ ./output Hello World
Q2
What will be the output of the following C++ code? #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(int argc, char const *argv[]) { vector <int> v = {90, 47, 34, 23, 4, 35, 67}; auto it = is_heap_until(v.begin(), v.end()); for(auto i = v.begin(); i != it; i++) cout<<*i<<" "; }
Q3
When does the next sequence point start?
Q4
What operator is used to remove the dupplicates in the range?
Q5
Which of the following header file is required for forwawrd_list?
Q6
Pick out the correct statement about multiple inheritances.
Q7
Which header file is used to manipulate the allocater?
Q8
Which keyword can be used in template?
Q9
What will be the output of the following C++ code? #include <iostream> using namespace std; class p { protected: int width, height; public: void set_values (int a, int b) { width = a; height = b; } virtual int area (void) = 0; }; class r: public p { public: int area (void) { return (width * height); } }; class t: public p { public: int area (void) { return (width * height / 2); } }; int main () { r rect; t trgl; p * ppoly1 = ▭ p * ppoly2 = &trgl; ppoly1->set_values (4, 5); ppoly2->set_values (4, 5); cout << ppoly1 -> area() ; cout << ppoly2 -> area(); return 0; }
Q10
Which are done by compiler for templates?
Q11
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, 5, 15}; vector<int> v(myints, myints + 5); make_heap (v.begin(), v.end()); pop_heap (v.begin(), v.end()); v.pop_back(); cout << v.front() << '\n'; return 0; }
Q12
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); auto cnj = conj(cn); cout<<"Conjugate of "<<real(cn)<<"+("<<imag(cn)<<")i is: "<<real(cnj)<<" +("<<imag(cnj)<<")i"<<endl; return 0; }
Q13
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { char name[30]; cout << "Enter name: "; gets(name); cout << "Name: "; puts(name); return 0; }
Q14
How many parameters are legal for non-type template?
Q15
What kind of pattern is iterator pattern?
Q16
Which operator is used to compare the elements in heap?
Q17
Which of the following is correct about the shift?
Q18
Which is the following is syntactically correct for vector<int> v?
Q19
What will be the output of the following C++ code? #include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main() { srand((unsigned)time(0)); int ran; int low = 1, high = 10; int range = (high - low) + 1; for(int index = 0; index < 1; index++) { ran = low + int(range * rand() / (RAND_MAX + 1.0)); cout << ran << endl; } }
Q20
What kind of functions are min and max in c++?
Q21
What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v1; vector<int> v2; for (int i = 1; i <= 5; i++) v1.push_back(i); for (int i = 6; i <= 10; i++) v2.push_back(i); v1.swap(v2); for(int i=0;i<v1.size();i++) cout<<v1[i]<<" "; for(int i=0;i<v2.size();i++) cout<<v2[i]<<" "; cout<<endl; return 0; }
Q22
How many types of linkages are there in C++?
Q23
What will be the output of the following C++ code? #include <iostream> #include <queue> using namespace std; int main () { queue<int> myqueue; int sum (0); for (int i = 1; i <= 10; i++) myqueue.push(i); while (!myqueue.empty()) { sum += myqueue.front(); myqueue.pop(); } cout << sum << endl; return 0; }
Q24
What will be the output of the following C++ code? #include<iostream> #include<stdlib.h> using namespace std; template<class T, class U, class V=double> class A { T x; U y; V z; }; int main() { A<int, int> a; A<double, double> b; cout << sizeof(a) << endl; cout << sizeof(b) << endl; return 0; }
Q25
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; mydeque.push_back (100); mydeque.push_back (200); mydeque.push_back (300); for(deque<int> :: iterator it = mydeque.begin(); it != mydeque.end(); ++it) { } mydeque.clear(); mydeque.push_back (110); mydeque.push_back (220); for(deque<int> :: iterator it = mydeque.begin(); it != mydeque.end(); ++it) cout << ' ' << *it; cout << '\n'; return 0; }