Q1. A class is AA variable onlyBA blueprint or template for creating objectsCA function onlyDAn instance of an object Show answer Answer: B. A blueprint or template for creating objects Report a mistake
Q2. An object is AA data type onlyBA blueprintCAn instance of a classDA function Show answer Answer: C. An instance of a class Report a mistake
Q3. The members of a class can be AData members and member functionsBOnly constructorsCOnly data membersDOnly functions Show answer Answer: A. Data members and member functions Report a mistake
Q4. Access specifiers in C++ are AOnly private and publicBOnly publicCopen, closed, hiddenDprivate, public, protected Show answer Answer: D. private, public, protected Report a mistake
Q5. By default, members of a class are ApublicBprotectedCglobalDprivate Show answer Answer: D. private Report a mistake
Q6. By default, members of a structure are AprivateBprotectedCpublicDhidden Show answer Answer: C. public Report a mistake
Q7. public members are accessible AOnly in derived classesBFrom anywhere in the programCOnly inside the classDOnly in main() Show answer Answer: B. From anywhere in the program Report a mistake
Q8. private members are accessible AOnly outside the classBOnly inside the class itselfCOnly in derived classesDFrom anywhere Show answer Answer: B. Only inside the class itself Report a mistake
Q9. protected members are accessible AFrom anywhereBOnly in main()CInside the class and its derived classesDOnly outside the class Show answer Answer: C. Inside the class and its derived classes Report a mistake
Q10. Encapsulation is ABinding data and functions together and hiding detailsBInheriting classesCCreating multiple objectsDOverloading functions Show answer Answer: A. Binding data and functions together and hiding details Report a mistake
Q11. Data hiding is achieved by AUsing macrosBMaking everything publicCUsing global variablesDMaking data members private Show answer Answer: D. Making data members private Report a mistake
Q12. A constructor is AA special member function that initializes objectsBAn operatorCA destructorDA normal function Show answer Answer: A. A special member function that initializes objects Report a mistake
Q13. Constructor has the same name as AAny functionBThe classCmain()DThe object Show answer Answer: B. The class Report a mistake
Q14. Constructor has Afloat return typeBint return typeCNo return type (not even void)Dvoid return type Show answer Answer: C. No return type (not even void) Report a mistake
Q15. Default constructor takes AAny numberBNo parametersCOne parameterDTwo parameters Show answer Answer: B. No parameters Report a mistake
Q16. Parameterized constructor takes AOne or more parametersBOnly default valuesCOnly one parameter alwaysDNo parameters Show answer Answer: A. One or more parameters Report a mistake
Q17. Copy constructor is used to ADelete an objectBInitialize with default valuesCConvert data typesDCreate a new object as a copy of existing object Show answer Answer: D. Create a new object as a copy of existing object Report a mistake
Q18. Destructor is called AAutomatically when object goes out of scopeBAt the beginning of programCOnly manuallyDNever Show answer Answer: A. Automatically when object goes out of scope Report a mistake
Q19. Destructor name is preceded by AAsterisk (*)BAmpersand (&)CHash (#)DTilde (~) Show answer Answer: D. Tilde (~) Report a mistake
Q20. A class can have ANo destructorBOnly constructorsCOnly one destructorDMultiple destructors Show answer Answer: C. Only one destructor Report a mistake
Q21. this pointer points to AThe current objectBGlobal dataCThe previous objectDNULL always Show answer Answer: A. The current object Report a mistake
Q22. Static data members ABelong to the class (shared by all objects)BBelong to each object separatelyCAre always privateDCannot be accessed Show answer Answer: A. Belong to the class (shared by all objects) Report a mistake
Q23. Static member functions can access ABoth static and non-static membersBOnly non-static membersCOnly static members of the classDOnly global variables Show answer Answer: C. Only static members of the class Report a mistake
Q24. Friend function is ACannot access private dataBNot a member but can access private membersCA member functionDAlways private Show answer Answer: B. Not a member but can access private members Report a mistake
Q25. Friend function is declared using keyword AprivateBpublicCstaticDfriend Show answer Answer: D. friend Report a mistake
Q26. Operator overloading means AOnly using arithmetic operatorsBGiving special meaning to operators for user-defined typesCCreating new operatorsDRemoving operators Show answer Answer: B. Giving special meaning to operators for user-defined types Report a mistake
Q27. Which operators cannot be overloaded? A+ and –B* and /C:: , .* , . , ?:D&& and || Show answer Answer: C. :: , .* , . , ?: Report a mistake
Q28. Inheritance allows AOnly creating objectsBA class to acquire properties of another classCOnly overloadingDOnly hiding data Show answer Answer: B. A class to acquire properties of another class Report a mistake
Q29. The class that is inherited from is called AFriend classBChild class onlyCDerived classDBase class / Parent class Show answer Answer: D. Base class / Parent class Report a mistake
Q30. The class that inherits is called ABase classBAbstract class onlyCParent classDDerived class / Child class Show answer Answer: D. Derived class / Child class Report a mistake
Q31. Types of inheritance in C++ include AOnly multipleBOnly multilevelCSingle, Multiple, Multilevel, Hierarchical, HybridDOnly single Show answer Answer: C. Single, Multiple, Multilevel, Hierarchical, Hybrid Report a mistake
Q32. Multiple inheritance means AA class inherits from only one classBA class inherits from more than one base classCMany classes inherit from oneDNo inheritance Show answer Answer: B. A class inherits from more than one base class Report a mistake
Q33. Visibility mode in inheritance can be AOnly privateBOnly publicCpublic, private, protectedDOnly protected Show answer Answer: C. public, private, protected Report a mistake
Q34. When inheritance is public AMembers are hiddenBAll members become privateCAll members become protectedDpublic members of base remain public in derived Show answer Answer: D. public members of base remain public in derived Report a mistake
Q35. Polymorphism means ACreating classesBOnly one formCMany forms (ability to take multiple forms)DHiding data Show answer Answer: C. Many forms (ability to take multiple forms) Report a mistake
Q36. Compile-time polymorphism is achieved by AVirtual functionsBFunction overloading and operator overloadingCOnly encapsulationDOnly inheritance Show answer Answer: B. Function overloading and operator overloading Report a mistake
Q37. Run-time polymorphism is achieved by AOnly templatesBFunction overloadingCOperator overloadingDVirtual functions Show answer Answer: D. Virtual functions Report a mistake
Q38. Virtual function is declared using keyword AstaticBinlineCvirtualDfriend Show answer Answer: C. virtual Report a mistake
Q39. Pure virtual function has AOnly empty bodyBReturn type void onlyCDeclaration ending with = 0DNo declaration Show answer Answer: C. Declaration ending with = 0 Report a mistake
Q40. A class containing pure virtual function is called AAbstract classBFriend classCConcrete classDStatic class Show answer Answer: A. Abstract class Report a mistake
Q41. Abstract class AHas no membersBCan be instantiated freelyCCannot be instantiated (no objects)DIs always final Show answer Answer: C. Cannot be instantiated (no objects) Report a mistake
Q42. Constructor is called when AAn object is destroyedBFunction is calledCProgram endsDAn object is created Show answer Answer: D. An object is created Report a mistake
Q43. Destructor is called when AProgram startsBAn object is createdCAn object is destroyedDFunction returns Show answer Answer: C. An object is destroyed Report a mistake
Q44. Member functions defined inside the class are by default AStaticBFriendCInlineDVirtual Show answer Answer: C. Inline Report a mistake
Q45. Objects of a class can be created AOnly inside the classBOnly globallyCNeverDIn main() or any function Show answer Answer: D. In main() or any function Report a mistake
Q46. The size of an empty class is A1 byte (usually)B0 byteC4 bytesD8 bytes Show answer Answer: A. 1 byte (usually) Report a mistake
Q47. Data members are also known as AFunctions onlyBMethods onlyCAttributes / PropertiesDConstructors Show answer Answer: C. Attributes / Properties Report a mistake
Q48. Member functions are also known as AMethods / BehaviorsBData onlyCAttributes onlyDVariables Show answer Answer: A. Methods / Behaviors Report a mistake
Q49. The main pillars of Object-Oriented Programming are AEncapsulation, Inheritance, Polymorphism (and Abstraction)BOnly variables and constantsCOnly loops and functionsDOnly arrays and pointers Show answer Answer: A. Encapsulation, Inheritance, Polymorphism (and Abstraction) Report a mistake