What is the primary purpose of the break statement in C++ loops? 

  • To skip the next iteration 
  • To pause the loop for a moment 
  • To terminate the loop 
  • To reduce execution time
The break statement in C++ is used to terminate the loop, irrespective of whether the loop's condition has been met or not. This can be useful when a certain condition, separate from the loop's terminating condition, is met and the loop needs to end prematurely.

A template that takes another template as a parameter is known as a _______. 

  • template class 
  • meta-template 
  • function template 
  • inheritance template
A meta-template is a template that takes another template as its parameter. This advanced concept allows for more abstraction and flexibility in template programming.

The result of dividing two integers in C++ is always a(n) _______. 

  • float 
  • char 
  • integer 
  • boolean
In C++, when two integers are divided, the result is always an integer. If there's any fractional part, it gets truncated. For instance, 5 divided by 2 results in 2, not 2.5. To obtain a floating-point result, one or both operands should be a floating-point type.

A function that calls itself directly or indirectly is known as a _______ function. 

  • recursive 
  • iterative 
  • overloaded 
  • main
A function that calls itself, either directly or by calling another function that eventually results in the original function being called again, is termed recursive.

In C++, which keyword is used to declare an abstract class? 

  • virtual 
  • volatile 
  • pure 
  • abstract
An abstract class in C++ is a class that cannot be instantiated and is meant to be inherited by other classes. It's declared using the virtual keyword, especially when a virtual function is set to 0, making it a pure virtual function, thus making the class abstract.

How does the short-circuit evaluation work in logical operators? 

  • Sequentially 
  • Left-to-right 
  • Both operands 
  • None required
Short-circuit evaluation refers to the evaluation of logical expressions in a left-to-right manner, stopping as soon as the outcome is determined. For instance, in the logical AND operation (&&), if the left operand is false, the right operand won't even be evaluated because the entire expression is already false.

What does the term “Diamond Problem” refer to in the context of C++ inheritance? 

  • Multiple inheritance ambiguity 
  • Memory leak in inheritance 
  • Abstract base class issue 
  • Diamond-shaped class structure
The "Diamond Problem" arises due to multiple inheritance when a particular class is accessible through multiple paths, often causing ambiguity. For instance, if two base classes A and B have the same method and a derived class inherits both A and B, there's ambiguity on which method to call if not overridden in the derived class.

What is the purpose of a pure virtual function in C++? 

  • To provide default functionality 
  • To force derived classes to provide an implementation 
  • To enhance runtime performance 
  • To prevent method overloading
A pure virtual function in C++ is declared using "= 0" and doesn't have an implementation in the base class. It's a way to ensure that derived classes provide their own implementation of the function, effectively making the base class abstract. This ensures a consistent interface.

Can a friend function of a class access the private members of that class? 

  • Only if the function is defined inside the class 
  • No, it can't 
  • Yes, it can 
  • Only if the class has no protected members
Friend functions are specially designated functions that are allowed to access the private and protected members of a class. This is their primary purpose. Although they can breach the encapsulation principle, they're useful in scenarios where certain external functions require closer integration with a class's internals.

What is slicing in the context of object-oriented programming in C++? 

  • Removing virtual functions 
  • Copying an object's base part 
  • Increasing object size 
  • Converting to different type
Slicing in C++ refers to the situation where a derived class object is assigned to a base class object. In such cases, only the base class's portion of the derived object is copied, and the additional members of the derived class are 'sliced off'. This can lead to unintended behaviors if not carefully managed.