Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous Difficulty: Medium

What will be the output of the following C++ code? #include <iostream> using namespace std; class Parent { public: Parent (void) { cout << "Parent()\n"; } Parent (int i) { cout << "Parent("<< i << ")\n"; }; Parent (void) { cout << "~Parent()\n"; }; }; class Child1 : public Parent { }; class Child2 : public Parent { public: Child2 (void) { cout << "Child2()\n"; } Child2 (int i) : Parent (i) { cout << "Child2(" << i << ")\n"; } ~Child2 (void) { cout << "~Child2()\n"; } }; int main (void) { Child1 a; Child2 b; Child2 c(42); return 0; }

Select the correct option to test your answer:

More Computer Questions

Consider you have an array of some random size. You need to perform dequeue operation. You can perform it using stack operation (push and pop) or using queue operations itself (enQueue and Dequeue). The output is guaranteed to be same. Find some differences? What will be the output of the following C# code snippet? static void Main(string[] args) { string s1 = "Hello" + "c" + "Sharp"; Console.WriteLine(s1); Console.ReadLine(); } What is the time complexity of the following code? public boolean isBalanced(String exp) { int len = exp.length(); Stack<Integer> stk = new Stack<Integer>(); for(int i = 0; i < len; i++) { char ch = exp.charAt(i); if (ch == '(') stk.push(i); else if (ch == ')') { if(stk.peek() == null) { return false; } stk.pop(); } } return true; } In Python, what is the purpose of the @classmethod decorator? Which statistical test is commonly used to determine if there is a significant difference between the means of two groups?