Which of the following sentences are true? (Select two answers)
Which of the following sentences are true? (Select two answers)A . lists may not be stored inside tuplesB . tuples may be stored inside listsC . tuples may not be stored inside tuplesD . lists may be stored inside listsView AnswerAnswer: B,D Explanation: Reference: https://www.afternerd.com/blog/python-lists-for-absolute-beginners/
Which of the following expression evaluate to True? (Select two answers)
Which of the following expression evaluate to True? (Select two answers)A . len(''•) == 1B . len(""" """) == oC . chr(ordCA') + 1) == 'B'D . ord("Z") - ord("z") -- ord("0")View AnswerAnswer: B
What is the expected output of the following code?
What is the expected output of the following code? def foo(x,y,z): return x(y) - x(z) print {f00(lambda x: x % 2, 2, 1) )A . 1B . 0C . -1D . an exception is raisedView AnswerAnswer: C
Executing the following snippet
Executing the following snippet will cause the dct:A . to hold two keys named ‘pi’ linked to 3.14 and 3.1415 respectivelyB . to hold two key named ‘pi’ linked to 3.14 and 3.1415C . to hold one key named ‘pi’ linked to 3.1415D . to hold two keys named ‘pi’...
Which of the following lambda definitions are correct? (Select two answers)
Which of the following lambda definitions are correct? (Select two answers)A . lanbda x, y; return x\y - x%yB . lambda x, y: x//y - x%yC . lambda (x, y = x\y x%yD . lambda x, y: (x, y)View AnswerAnswer: B,D
Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers)
Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers) A. str(Object) == 'Object' B. _name == _main_' C. ClassA. _module_ == 'ClassA' D. len(ClassB.__bases__) == 1View AnswerAnswer: B,D
What is the expected output of the code?
The following class hierarchy is given. What is the expected output of the code? A . BBB . CCC . AAD . BCView AnswerAnswer: D
A class constructor (Select two answers)
A class constructor (Select two answers)A . can return a valueB . cannot be invoked directly from inside the classC . can be invoked directly from any of the subclassesD . can be invoked directly from any of the superclassesView AnswerAnswer: B,C
Python's built-in function named open () tries to open a file and returns:
Python's built-in function named open () tries to open a file and returns:A . an integer value identifying an opened fileB . an error code (0 means success)C . a stream objectD . always NoneView AnswerAnswer: C Explanation: Reference: https://www.programiz.com/python-programming/file-operation
What is the expected behavior of the following code?
What is the expected behavior of the following code? A . the code is erroneus and it will not executeB . it outputs [2, 4]C . it outputs [4, 2]D . it outputs [0, 1, 2, 3, 4]View AnswerAnswer: C