C++ Programming Test By Kishor Raut - August 21, 2021 FacebookTwitterPinterestWhatsApp Welcome to your C++ Programming Test 1. What will be the output of following code ? #include using namespace std; void fun() { static int i = 10; i++; cout << i; } int main() { fun(); fun(); fun(); return 0; }A. 101112B. 111111C. 111213D. error 2. You can never use or compute address of _________ variable ?A. localB. staticC. globalD. register 3. What will be the output of following code ? #include using namespace std; void calc(int x); int main() { int x = 10; calc(x); printf("%d", x); return 0; } void calc(int x) { x = x + 10 ; }A. 20B. 10C. 0D. error 4. Default storage class for local variables is ?A. autoB. registerC. staticD. extern 5. __________ is defined as user defined data type and it also contains functions in it ?A. ObjectB. Data membersC. ClassD. Polymorphism 6. For below code snippet, the public and protected members of Superclass becomes _________ members of Sub class. class subclass : protected SuperclassA. publicB. privateC. protectedD. None of the above 7. What will be the output of following code ? #include using namespace std; class Animal { public: int legs = 4; }; class Dog : public Animal { public: int tail = 1; }; int main() { Dog d; cout << d.legs; cout << d.tail; }A. errorB. 44C. 40D. 41 8. Do base class and its object have any knowledge about any classes derived from base class?A. YesB. No 9. What is Multiple Inheritance ?A. Deriving a class from Base classB. Deriving a derived class from two and more classC. Deriving two or more class from a base classD. None of the above 10. Whenever you create derived class object, first the base class default constructor is executed and then the derived class constructor?A. trueB. false 11. Which of the following Function is not inherited?A. constructorB. destructorC. Assignment operator(=)D. All of the above 12. What will be the output of following code? #include using namespace std; class Base { public: Base() { cout << "Base"; } }; class Derived : public Base { public: Derived(int i) { cout << i; } }; int main() { Derived d2(10); return 0; }A. Base10B. 10C. 10BaseD. error 13. What will be the output of following code? #include using namespace std; class A { int x; }; class B : public A { public: void show() { x=10; cout << x; } }; int main() { B b; b.show(); return 0; }A. 10B. 0C. errorD. garbage value 14. Which symbol is used to create multiple inheritance ?A. Dot(.)B. Comma(,)C. Colon(:)D. None of the above 15. All members of a Base class including private member are inherited in Derived class.A. trueB. false Time is Up!