In C++, protected members are inaccessible to client and to derived classes.
A) True
B) False
✅ B) False
Explanation: Protected members are accessible to derived (child) classes but not to outside code. Only private members are inaccessible to both.
__________ function in C++ is a function for which the compiler attempts to replace the function call with the function’s code itself.
A) virtual
B) inline
C) final
D) friend
✅ B) inline
Explanation: Inline functions replace the function call with its code to reduce overhead.
In C++, instead of storing the actual method implementation inside each object, the object has a pointer to a table (vtable) that stores the addresses of dynamically bound methods.
A) True
B) False
✅ A) True
Explanation: Each object of a class with virtual functions has a pointer to a vtable containing addresses of overridden methods.
C++ excludes classes from type checking.
A) True
B) False
✅ B) False
Explanation: C++ enforces compile-time type checking, including for class types.
While garbage collector reduces manual memory management, it can cause unpredictable pauses in program execution and negatively impact performance, especially in real-time or performance-critical applications.
A) True
B) False
✅ A) True
Explanation: Garbage collection introduces execution pauses. C++ avoids this by using manual memory management.
All virtual functions in C++ are dynamically bound.
A) True
B) False
✅ A) False
C++ offers multiple inheritance using a comma-separated list of base classes.
A) True
B) False
✅ A) True
Explanation: C++ supports multiple inheritance; classes can inherit from multiple parents using commas.
Some OOP languages, like Java and C++, allow you to mark methods or classes as __________, which means they cannot be overridden.
A) virtual
B) inline
C) final
D) friend
✅ C) final
Explanation: The final keyword prevents overriding or inheritance of methods/classes.
In C++, a function declared with a 0 and the keyword virtual is an abstract function and it cannot be called. It must be overridden in a derived class.
A) True
B) False
✅ A) True
Explanation: A pure virtual function (virtual void f() = 0;) acts like an abstract method and must be implemented by derived classes.
In C++, the __________ keyword is a mechanism that allows a class to grant another class or function access to its private and protected members, which are normally hidden from other parts of the program.
A) virtual
B) inline
C) friend
D) final
✅ C) friend
Explanation: Friend allows specified functions or classes to access private/protected members of another class.