Question 11
How does C++ solve the 'Diamond Problem' in multiple inheritance?
Option A is correct. Virtual base classes ensure that only one copy of the common base class subobject is shared among intermediate derived classes.
How does C++ solve the 'Diamond Problem' in multiple inheritance?
Option A is correct. Virtual base classes ensure that only one copy of the common base class subobject is shared among intermediate derived classes.
Which function parameter passing mechanism in C creates a copy of the argument's value in the function's parameter variable?
Option A is correct. In Pass by Value, changes made to the parameter inside the function do not affect the original caller argument.
In C, what is the default return type of a function if not explicitly specified in traditional C compilers?
Option D is correct. Both Option A and related standard techniques apply here. In older C standards (C89/C90), if a return type was omitted in a function definition, the compiler assumed it returned 'int'.
What is the key difference between a struct and a union in C?
Option C is correct. In a struct, memory is allocated for all members sequentially. In a union, memory size equals the size of its largest member, shared by all.
In C++, which keyword is used to prevent a class from being inherited or a virtual function from being overridden?
Option A is correct. Introduced in C++11, the 'final' specifier prevents further derivation of a class or further overriding of a virtual method.