Question 1 of 25
Hints left: 3
Q1
From where does the template class derived?
Q2
What will be the output of the following C++ code? #include <iostream> using namespace std; class Cat { public: int age; int weight; }; int main() { Cat f; f.age = 56; cout << "Gates is " ; cout << f.age << " years old.\n"; }
Q3
Which access specifier is used where one wants data members to be accessed by other classes but not from outside objects?
Q4
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<<"Norm is: "<<norm(cn)<<endl; return 0; }
Q5
What will be the output of the following C++ code? #include <iostream> #include <bitset> using namespace std; int main() { bitset<8> b1(95); bitset<8> b2(46); cout<<(b1^b2); }
Q6
What is the use of includes function in c++?
Q7
What are the operators available in C++ for dynamic allocation and de-allocation of memories?
Q8
Which type of heap is implemented in STL heap?
Q9
If i1 is Input Iterator and i2 is Output Iterator, then which of the following things are correct? i) cout<<*i1; ii) i2 can be used with == operator iii) *i1 = 1 iv) i2--
Q10
Which of the following queue container can expand or shrink from both directions?
Q11
What is meant by container ship?
Q12
Which classes can have vtable?
Q13
Which of the following is the correct syntax of using pair p?
Q14
What is sequence container arrays?
Q15
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[12] = "H3ll0\tW0r1d"; for(int i=0;i<12;i++) { cout<<(bool)iscntrl(arr[i]); } }
Q16
What will be the output of the following C++ code? #include <cstdlib> #include <iostream> using namespace std; int main() { cout << RAND_MAX << endl; }
Q17
Which of the following is correct about remove_all_extents() function?
Q18
How one can restrict a function to throw particular exceptions only?
Q19
To what kind of elements does non-modifying sequence algorithm can be applied?
Q20
Which function is used to position back from the end of file object?
Q21
What will be the output of the following C++ code? #include <stdio.h> int main () { int n; FILE * p; char buffer [5]; p = fopen ("myfile.txt", "w+"); for ( n = 'A' ; n <= 'D' ; n++) fputc ( n, p); rewind (p); fread (buffer, 1, 5, p); fclose (p); buffer[3] = '\0'; puts (buffer); return 0; }
Q22
How many parameters does a operator() in a function object shoud take?
Q23
What will be the output of the following C++ code? #include <iostream> #include <functional> #include <algorithm> using namespace std; int main () { int numbers[] = {10, -20, -30, 40, -50}; int cx; cx = count_if ( numbers, numbers + 5, bind2nd(less<int>(), 0) ); cout << cx; return 0; }
Q24
How many types of templates are there in c++?
Q25
Identify the incorrect statement.