Question 71
What is the value of C expression: 10 + 20 * 3 / 5 - 2?
Operator precedence: * and / before + and -. 20 * 3 = 60. 60 / 5 = 12. 10 + 12 - 2 = 20.
What is the value of C expression: 10 + 20 * 3 / 5 - 2?
Operator precedence: * and / before + and -. 20 * 3 = 60. 60 / 5 = 12. 10 + 12 - 2 = 20.
In C++, what is a 'Mutable' member variable declared with the 'mutable' keyword?
The 'mutable' specifier allows changing specific object fields from const methods (e.g., thread locks, cache counters).
What is the worst-case time complexity of 'std::sort()' in C++ STL?
The standard requires std::sort to have O(N log N) comparisons in the worst case. Implementations may use techniques such as introsort to achieve this bound.
In C++, which header file provides algorithms like std::sort(), std::find(), std::binary_search()?
<algorithm> defines generic algorithmic functions that operate on STL container iterators.
In Python decorators, what is the role of '@staticmethod'?
@staticmethod methods belong to class namespace but act like plain functions without instance/class references.