Question 71
A class constructor (Select two answers)
A. can return a value
B. cannot be invoked directly from inside the class
C. can be invoked directly from any of the subclasses
D. can be invoked directly from any of the superclasses
Question 72
The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns.
Which of the invocations should be used instead of XXX?
A. print (get(self))
B. print (self.get())
C. print (get())
D. print (self.get (val))
Question 73
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
Question 74
You are going to read 16 bytes from a binary file into a bytearray called data.
Which lines would you use? (Choose two.)
A. data = bytearray (16) bf.readinto (data)
B. data = binfile.read (bytearray (16))
C. bf. readinto (data = bytearray (16))
D. data = bytearray (binfile.read (16))
Question 75
What is the expected output of the following snippet?
A. True False
B. True True
C. False False
D. False True
Question 76
Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Choose two.)
A. v1>=1
B. v1==v2
C. len(random.sample([1,2,3],2)) > 2
D. random.choice([1,2,3])>=1
Question 77
Which one of the platform module functions should be used to determine the underlying platform name?
A. platform.python_version()
B. platform.processor()
C. platform.platform()
D. platform.uname()
Question 78
What is the expected output of the following code?
A. False
B. None
C. True
D. 0
Question 79
With regards to the directory structure below, select the proper forms of the directives in order to import module_a. (Choose two.)
A. from pypack import module_a
B. import module_a from pypack
C. import module_a
D. import pypack.module_a
Question 80
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()