Question 6
Analyze the following snippet and select the statement that best describes it.
- The code is syntactically correct despite the fact that the names of the function parameters do not follow the naming convention
- The *arg parameter holds a list of unnamed parameters.
- The code is missing a placeholder for unnamed parameters.
- The code is syntactically incorrect - the function should be defined as def f1 (*args, **kwargs):
Question 7
Analyze the following snippet and decide whether the code is correct and/or which method should be distinguished as a class method.
- There is only one initializer, so there is no need for a class method
- The getNumberOfCrosswords() method Should be decorated with @classmethod
- The code is erroneous
- The getNumberOfCrosswords() and isSolved methods should be decorated with @classmethod
Question 8
Analyze the code and choose the best statement that describes it.
- __ne__() is not a built-in special method.
- The code is erroneous
- The code is responsible for the support of the negation operator, e.g. a = - a
- The code is responsible for the support of the inequality operator, i.e. !=
Question 9
Which function or operator should you use to obtain the answer True or False to the question "Do two variables refer to the same object?"
- The == operator
- The isinstance() function
- The id() function
- The is function
Question 10
Which sentence about the @property decorator is false?
- The @property decorator should be defined after the method that is responsible for setting an encapsulated attribute.
- The @property decorator designates a method which is responsible for returning an attribute value.
- The @property decorator marks the method whose name will be used as the name of the instance attribute.
- The @property decorator should be defined before the methods that are responsible for setting and deleting an encapsulated attribute.