What can you deduce from the following statement? (Select two answers)
A. str is a string read in from the file named file.txt
B. a newline character translation will be performed during the reads
C. if file. txt does not exist, it will be created
D. the opened file cannot be written with the use of the str variable
How many stars (*) does the snippet print?
A. the code is erroneous
B. five
C. four
D. two
What is the expected behavior of the following code?
It will:
A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line
If S is a stream open for reading, what do you expect from the following invocation?
A. one line of the file will be read and stored in the string called C
B. the whole file content will be read and stored in the string called C
C. one character will be read and stored in the string called C
D. one disk sector (512 bytes) will be read and stored in the string called C
A Python module named pymod.py contains a function named pyfun().
Which of the following snippets will let you invoke the function? (Choose two.)
A. import pymod pymod.pyfun()
B. from pymod import pyfun pyfun()
C. from pymod import * pymod.pyfun()
D. import pyfun from pymod pyfun()
What is the expected behavior of the following code?
A. it outputs 0
B. it raises an exception
C. it outputs 1
D. it outputs 2
Which of the following snippets will execute without raising any unhandled exceptions?
A. Option A
B. Option B
C. Option C
D. Option D
With regards to the directory structure below, select the proper forms of the directives in order to import module_b. (Choose two.)
A. from pyback.upper import module_b
B. import pyback.upper.module_b
C. import upper.module_b
D. import module_b
What is the expected output of the following snippet?
A. True lower
B. True upper
C. False upper
D. False lower
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? (Choose two.)
A. ClassA.__module__ == `__main__'
B. __name__ == `__main__'
C. str(Object) == `Object'
D. len(ClassB.__bases__) == 2