Question 1 of 25
Hints left: 3
Q1
What is mersenne_twister_engine?
Q2
Which is used to solve the memory management problem in c++?
Q3
Which operator is used to declare the destructor?
Q4
What will be the output of the following C++ code? #include <stdio.h> #include <ctype.h> int main () { int i = 0; int cx = 0; char str[] = "Hello, welcome!"; while (str[i]) { if (ispunct(str[i])) cx++; i++; } printf ("%d\n", cx); return 0; }
Q5
Where exception are handled?
Q6
Which operator is used to access the first or second element of a pair?
Q7
What will be the output of the following C++ code? #include<iostream> #include "math.h" using namespace std; double MySqrt(double d) { if (d < 0.0) throw "Cannot take sqrt of negative number"; return sqrt(d); } int main() { double d = 5; cout << MySqrt(d) << endl; }
Q8
What will be the output of the following C++ code? #include <iostream> using namespace std; class class0 { public: virtual ~class0(){} protected: char p; public: char getChar(); }; class class1 : public class0 { public: void printChar(); }; void class1::printChar() { cout << "True" << endl; } int main() { class1 c; c.printChar(); return 1; }
Q9
How the relationship is made in Association?
Q10
Which of the following operators are overloaded for functors?
Q11
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; template<class T> class A { public: A(){ cout<<"Created\n"; } ~A(){ cout<<"Destroyed\n"; } }; int main(int argc, char const *argv[]) { A <int>a; return 0; }
Q12
What is the main purpose of the constructor?
Q13
Choose the correct formatted code.
Q14
By seeing which operator thus this C++ program stops getting the input? #include <iostream> #include <fstream> using namespace std; int main () { char ch; streambuf * p; ofstream os ("test.txt"); pbuf = os.rdbuf(); do { ch = cin.get(); p -> sputc(ch); } while (ch != '.'); os.close(); return 0; }
Q15
How many parameters are required for sort_heap function?
Q16
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; char y; string z; tie(x,y,z) = tp1; cout<<"x: "<<x<<"\ny: "<<y<<"\nz: "<<z<<endl; return 0; }
Q17
What is the signature of math in function using command line arguments?
Q19
What can go wrong in resource management on c++?
Q20
Which of the following statements regarding absolute and concrete classes in C++ is correct?
Q21
Which value is placed in the base class?
Q22
What will be the output of the following C++ code? #include<iostream> using namespace std; int main() { int x = 5; auto check = []() -> bool { if(x == 0) return false; else return true; }; cout<<check()<<endl; return 0; }
Q23
What will be the output of the following C++ code? #include <vector> #include <algorithm> #include <iostream> using namespace std; int main() { vector<int> v; for(int i=0;i<10;i++) v.push_back(i+1); for(int i=0;i<10;i++) cout<<v[i]<<" "; cout<<endl; random_shuffle(v.begin(), v.end()); for(int i=0;i<10;i++) cout<<v[i]<<" "; return 0; }
Q24
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> tp; tp = make_tuple(4, '1', "Hello"); return 0; }
Q25
What are the Generators in C++?