Question 1 of 25
Hints left: 3
Q1
How many elements does a floating point number is composed of?
Q2
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { vector<int> myvector (4); fill (myvector.begin(), myvector.begin() + 2, 3); fill (myvector.begin() + 1, myvector.end() - 1, 4); for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it) cout << ' ' << *it; return 0; }
Q3
With which does the trigonometric functions work with angles in c++?
Q4
What is the header file used for declaring the standard library algorithms?
Q5
What is meant by standard c++ library?
Q7
Which of the following mathematical function is overloaded in <complex> and <valarray>?
Q8
Which of the following is best to include under try block?
Q9
How many types of Iterators are provided by C++?
Q10
What will be the output of the following C++ code? #include <iostream> #include <algorithm> using namespace std; int main () { int myints[] = {10, 20, 30, 30, 20, 10, 10, 20}; int* pbegin = myints; int* pend = myints + sizeof(myints) / sizeof(int); pend = remove (pbegin, pend, 20); for (int* p = pbegin; p != pend; ++p) cout << ' ' << *p; return 0; }
-
A
-
B
-
C
-
D
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, 30, 20, 10, 10, 20}; int mycount = count (myints, myints + 8, 10); cout << "10 appears " << mycount << " times.\n"; vector<int> myvector (myints, myints+8); mycount = count (myvector.begin(), myvector.end(), 20); cout << "20 appears " << mycount << " times.\n"; return 0; }
Q12
What are the Associative Containers?
Q13
What are the Sequence Containers?
Q14
Pick out the correct syntax of the header file that can be used with C++.
Q15
What will be the output of the following C++ code? #include <stdio.h> #include <stdlib.h> int main () { div_t divresult; divresult = div (38, 5); printf ("%d\n", divresult.rem); return 0; }
Q16
What will be the output of the following C++ code? #include <stdio.h> #include <stdlib.h> int main () { int n, m; n = abs(23); m = abs(-11); printf ("%d", n); printf ("%d", m); return 0; }
Q17
How many Associative Containers are provided by C++?
Q18
What is meant by vector in the container library contains?
Q19
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { int first[] = {5, 10, 15, 20, 25}; int second[] = {50, 40, 30, 20, 10}; vector<int> v(10); vector<int> :: iterator it; sort (first, first + 5); sort (second, second + 5); it = set_union (first, first + 5, second, second + 5, v.begin()); cout << int(it - v.begin()); return 0; }
Q20
How many macros are used by mathematical functions in the header file <cerrno>?
Q21
What will be the output of the following C++ code? #include <iostream> #include <exception> using namespace std; int main () { try { int* myarray= new int[1000]; cout << "Allocated"; } catch (exception& e) { cout << "Standard exception: " << e.what() << endl; } return 0; }
Q22
How many Container Adaptors are provided by C++?
Q23
What will be the output of the following C++ code? #include <stdio.h> #include <stdlib.h> int compareints (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int values[] = { 50, 20, 60, 40, 10, 30 }; int main () { int * p; int key = 40; qsort(values, 6, sizeof (int), compareints); p = (int*) bsearch (&key, values, 6, sizeof (int), compareints); if (p != NULL) printf ("%d\n",*p); return 0; }
Q24
What are the containers?
Q25
What will be the output of the following C++ code? #include <typeinfo> #include <iostream> using namespace std; class Test { public: Test(); virtual ~Test(); }; int main() { Test *ptrvar = NULL; try { cout << typeid(*ptrvar).name() << endl; } catch (bad_typeid) { cout << "The object is null" << endl; } return 0; }