Question 1 of 25
Hints left: 3
Q1
Which function is used to check whether a character is punctuation mark?
Q2
What will be the output of the following C++ code? #include <iostream> #include <vector> #include <forward_list> using namespace std; int main() { forward_list<int> fl1 = {1,7,8,9,10}; forward_list<int> fl2 = {2,3,4,5,6}; fl1.splice_after(fl1.begin(), fl2); for (int&c : fl1) cout << c << " "; cout<<endl; return 0; }
Q3
Which function is used to calculate the norm of a complex number?
Q4
Where does the abstract class is used?
Q5
What does RAII stand for in C++?
Q6
What will be the output of the following C++ code? #include <iostream> #include <functional> #include <numeric> using namespace std; int myop (int x, int y) { return x + y; } int main () { int val[] = {1, 2, 3, 5}; int result[7]; adjacent_difference (val, val + 7, result); for (int i = 0; i < 4; i++) cout << result[i] <<' '; return 0; }
Q7
What is the purpose of the volatile keyword in C++?
Q8
Which header file is used for generating random numbers?
Q9
What is an abstract class in C++?
Q10
What will be the output of the following C++ code? #include<iostream> using namespace std; class X { int m; public: X() : m(10) { } X(int mm): m(mm) { } int getm() { return m; } }; class Y : public X { int n; public: Y(int nn) : n(nn) {} int getn() { return n; } }; int main() { Y yobj( 100 ); cout << yobj.getm() << " " << yobj.getn() << endl; }
Q11
Given below classes which of the following are the possible row entries in vtable of D1 class? class Base { public: virtual void function1() {}; virtual void function2() {}; }; class D1: public Base { public: virtual void function1() {}; }; class D2: public Base { public: virtual void function2() {}; };
Q12
What will be the output of the following C++ code? #include <iostream> #include <limits> using namespace std; int main( ) { cout << numeric_limits<float> :: is_exact; cout << numeric_limits<double> :: is_exact; cout << numeric_limits<long int> :: is_exact; cout << numeric_limits<unsigned char> :: is_exact; }
Q13
Pick the incorrect statement.
Q14
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[20] = "\'H3ll0\'"; for(int i=0;i<8;i++) { cout<<(bool)ispunct(arr[i]); } }
Q15
Which of the following is correct about Input Iterators?
Q16
Which of the following is not a valid C++ standard library container?
Q17
Which function is used to check whether a character is a number?
Q18
Which is the best design choice for using pointer to member function?
Q19
Which class is used to design the base class?
Q20
What will be the capacity of the vector after 10 is pushed into the vector in 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.capacity()<<endl; v.shrink_to_fit(); cout<<v.capacity()<<endl; v.push_back(10); return 0; }
Q21
What is the purpose of the const keyword in C++?
Q22
Which of the following is correct about map and multimap?
Q23
What is the syntax of printing the first element of an array Arr using get() function?
Q24
How many kinds of parameters are there in C++?
Q25
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(45); cout<<~b1<<endl; cout<<(b1|b2)<<endl; cout<<(b1&b2)<<endl; }