How does a member function differ from a regular function in C++? 

  • It can only be called by an object. 
  • It does not have a return type. 
  • It always has parameters. 
  • It cannot be defined inside a class.
A member function in C++ is associated with an object of the class and has access to the object's data members. Unlike regular functions, member functions can be called using the object of the class and can manipulate the class's attributes directly. Regular functions don't have this implicit access.

In C++, function overloading is resolved at _______. 

  • runtime 
  • declaration time 
  • compile-time 
  • execution-time
Function overloading allows multiple functions in the same scope to have the same name as long as they have different parameter lists. In C++, the appropriate overloaded function is chosen at compile-time based on the function call's arguments.

Which keyword is used in C++ to make a function virtual? 

  • static 
  • const 
  • virtual 
  • override
The keyword virtual is used in C++ to make a function virtual. When a function is declared as virtual, it can be overridden in any derived class. This allows for dynamic polymorphism, where the decision on which method version to execute is made at runtime based on the object's actual type.

Which of the following statements about the if-else control structure is true? 

  • It can only test for numeric conditions. 
  • It executes the else block if the if condition is true. 
  • It allows for multiple conditions to be checked in sequence. 
  • It requires both if and else parts.
The if-else control structure in C++ provides a way to perform decision-making operations. If the condition inside the 'if' block evaluates to true, the 'if' block of code is executed; otherwise, the 'else' block is executed, if present. It can be used to check multiple conditions in sequence by nesting or using "else if".

To get the quotient of a division in C++, we use the _______ operator. 

  • &&
In C++, the forward slash (/) operator is used for division. When used between two integers, it gives the quotient of the division.

Which of the following is true about the complexity of the std::list::remove function? 

  • O(1) 
  • O(log n) 
  • O(n) 
  • O(n log n)
The std::list::remove function has a linear time complexity O(n). This is because it traverses the list once, removing all elements that match a specified value. As it potentially examines all elements, the complexity is linear.

The process of transferring the program control from where the exception was thrown to the catch block is known as _______. 

  • Throwing 
  • Handling 
  • Propagation 
  • Initialization
Propagation refers to the process where after an exception is thrown, it travels up the call stack until it's caught by an appropriate catch block or, if uncaught, the program terminates.

The diamond problem occurs due to _______ and can be resolved using _______. 

  • inheritance, interfaces 
  • encapsulation, templates 
  • multiple inheritance, virtual inheritance 
  • overloading, namespaces
The diamond problem is a complication that arises from multiple inheritance when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C? This ambiguity can be resolved in C++ using virtual inheritance, ensuring that only one instance of the base class exists in the derived class.

In C++, a size of long double is at least _______ bytes. 

  • 10 
  • 12 
  • 16
In C++, the size of long double is compiler-dependent. However, according to the C++ standard, it is at least 8 bytes or the size of a double, whichever is greater. Some compilers may allocate more.

Using templates excessively can lead to an issue known as _______. 

  • recursion 
  • template bloat 
  • overloading 
  • specialization
Excessive use of templates can result in code that has much larger compiled sizes than equivalent non-template code. This phenomenon, where the binary gets bloated due to templates, is known as template bloat.