What is the primary difference between direct and indirect recursion? 

  • Direct calls itself, while indirect calls another function that calls it back. 
  • Direct uses less memory than indirect. 
  • Direct is slower than indirect. 
  • Direct is always safer than indirect.
Direct recursion occurs when a function calls itself directly, whereas indirect recursion involves a function calling another function that eventually calls the original function. It's a cycle of calling between two or more functions.

In a for loop, what will happen if the condition is omitted? 

  • It will throw a syntax error. 
  • The loop will execute once. 
  • The loop will never execute. 
  • The loop will execute indefinitely.
In a for loop, if the condition is omitted, it's treated as always true. Therefore, the loop will execute indefinitely unless there's a break statement or some external factor that interrupts its execution.

The conditions in a switch-case statement must be of _______ data type. 

  • floating 
  • string 
  • integer or enum 
  • boolean
In a switch-case structure in C++, the conditions or cases must be of an integer or enumeration type. Floating-point and boolean values cannot be used as cases.

When a class contains a pointer to memory allocated in class, we should define a _______. 

  • destructor 
  • constructor 
  • overloader 
  • allocator
When a class contains a pointer that has memory allocated to it dynamically, it's crucial to have a destructor to release that memory when the object is destroyed to prevent memory leaks.

When a continue statement is encountered in a loop, the program control resumes from _______. 

  • next statement 
  • loop condition 
  • beginning of loop 
  • end of loop
The continue statement, when encountered inside a loop, causes the program to skip the rest of the current iteration and move directly to the loop condition to check if the next iteration should commence. In essence, it "continues" to the next iteration of the loop without finishing the current one.

You're developing an embedded system with constrained memory. What should be the main consideration when choosing between using float and double data types? 

  • Precision needs 
  • Popularity of type 
  • Storage size requirement 
  • Arithmetic operations
In embedded systems with memory constraints, storage size becomes a primary concern. A float generally occupies 4 bytes, while a double occupies 8 bytes. Hence, if precision offered by float is acceptable for the application, it would be preferable to use float to save memory space.

Which keyword is used to inherit a class in C++? 

  • import 
  • extend 
  • inherit 
  • public
In C++, inheritance is specified by placing the colon (:) followed by an access specifier (public, protected, or private) and then the name of the base class. The public keyword itself is not used for inheritance, but rather indicates the type of inheritance.

In situations where the argument should not be modified, passing by _______ is preferable to ensure the original data remains unaltered. 

  • value 
  • reference 
  • name 
  • pointer
Passing by value means the function receives a copy of the argument. As a result, any changes made to the parameter within the function don't affect the original data, ensuring it remains unaltered outside the function's scope.

The _______ operator is used to compare whether two C++ values are not equal. 

  • != 
  • == 
  • >= 
  • <=
The != operator in C++ is the "not equal to" operator. It returns true if the operands on either side are not equal. For example, 5 != 3 evaluates to true, while 5 != 5 evaluates to false. The other options represent other comparison operations.

When passing by reference, changes made to the parameter within the function _______ the original argument. 

  • alter 
  • bypass 
  • skip 
  • hide
When passing arguments by reference in C++, any modifications made to the parameter within the function directly alter the original argument. This is different from passing by value, where the function works on a copy and the original remains unchanged.