Skip to content

Category Archives: C++ Quiz

Forward list in standard template library of C++. It comes under #include<forward_list> header file. It is implemented as a singly linked list. It was introduced… Read More
#include<iostream> using namespace std; int main () {        int cin;        cin >> cin;        cout << "cin" << cin;        return 0; } Thanks to Gokul Kumar… Read More
#include<iostream> using namespace std;    int x[100]; int main() {     cout << x[99] << endl; } This question is contributed by Sudheendra Baliga (A) Unpredictable… Read More
Consider the below C++ program. #include<iostream> using namespace std; class A { public:      A(){ cout <<"1";}      A(const A &obj){ cout <<"2";} };    class B:… Read More
Would destructor be called, if yes, then due to which vector? #include <iostream> #include <vector> using namespace std;    class a { public :     ~a()… Read More
Output of C++ program? #include <iostream> int const s=9; int main() {     std::cout << s;     return 0; } Contributed by Pravasi Meet (A) 9 (B)… Read More
Output of following C++ program? #include <iostream> class Test { public:     void fun(); }; static void Test::fun()    {     std::cout<<"fun() is static\n"; } int main() {… Read More
Which of the following is true about the following program #include <iostream> class Test { public:     int i;     void get(); }; void Test::get() {     std::cout… Read More
#include <stdio.h> int main() {    const int x;    x = 10;    printf("%d", x);    return 0; } (A) Compiler Error (B) 10 (C) 0 (D) Runtime… Read More
Output of following C++ program? #include<iostream> using namespace std;    int main() {   int x = 10;   int& ref = x;   ref = 20;   cout… Read More
Can destructors be virtual in C++? (A) Yes (B) No Answer: (A) Explanation: See https://www.geeksforgeeks.org/g-fact-37/Quiz of this Question My Personal Notes arrow_drop_up Save
Predict the output of following C++ program #include<iostream> using namespace std;    class Base { public:     virtual void show() { cout<<" In Base \n"; }… Read More
#include<iostream> using namespace std;    class Base1 { public:     char c; };    class Base2 { public:     int c; };    class Derived: public Base1,… Read More
#include<iostream> using namespace std;    class Base { protected:     int a; public:     Base() {a = 0;} };    class Derived1:  public Base { public:     int… Read More
#include<iostream> using namespace std;    class Base { public :     int x, y; public:     Base(int i, int j){ x = i; y = j; }… Read More