Question 91
What is the output of the Python expression: list(range(10, 0, -2))?
range(10, 0, -2) starts at 10, decrements by 2, and stops before 0 (10, 8, 6, 4, 2).
What is the output of the Python expression: list(range(10, 0, -2))?
range(10, 0, -2) starts at 10, decrements by 2, and stops before 0 (10, 8, 6, 4, 2).
In C++, what is a 'Template' (Function/Class Template)?
Templates enable type-parameterized functions and classes (e.g., template <typename T> T add(T a, T b)).
Which Python dictionary method updates a dictionary with key-value pairs from another mapping or iterable of pairs?
dict.update(other) adds or replaces key-value pairs using another mapping or an iterable of key-value pairs.
In C++, what is a 'Friend Class'?
Declaring 'friend class B;' inside class A gives class B access to all private/protected members of A.
In Python, what is the output of evaluating '3 in [1, 2, 3]' and '4 not in [1, 2, 3]'?
The 'in' and 'not in' membership operators check element presence in sequences, both returning True.