Question 61
In C++, what does the scope resolution operator (::) do when used without a class or namespace prefix (e.g., ::x)?
Unary :: explicitly resolves identifiers to global namespace scope.
In C++, what does the scope resolution operator (::) do when used without a class or namespace prefix (e.g., ::x)?
Unary :: explicitly resolves identifiers to global namespace scope.
What is the output of the Python expression: 'hello'.upper().lower().capitalize()?
upper() gives 'HELLO', lower() gives 'hello', capitalize() converts first char to uppercase giving 'Hello'.
Which built-in Python function checks if an object is an instance of a specified class or a subclass thereof?
isinstance(object, classinfo) returns True if object is an instance of classinfo or its subclasses.
In Python, what is 'Duck Typing'?
Summarized as 'If it walks like a duck and quacks like a duck, it's a duck'-behavior dictates type compatibility.
In Python, what does the 'dir()' built-in function return when called on an object?
dir(object) returns a sorted list of strings containing all valid attribute and method identifiers of the object.