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())
B. print (get(self))
C. print (self.get())
D. print (self.get (val))
正解:B
質問 2:
Which of the following statements are true? (Select two answers)
A. Python strings can be concatenated
B. Python strings can be sliced like lists
C. Python strings are mutable
D. Python strings are actually lists
正解:A,B
質問 3:
A function called issubclass (c1, c2)is able to check if:
A. c2 is a subclass of c1
B. c1 is a subclass of c2
C. c1 and c2 are not subclasses of the same superclass
D. c1 and c2 are both subclasses of the same superclass
正解:B
質問 4:
If S is a stream open for reading, what do you expect from the following invocation?
A. one character will be read and stored in the string called C
B. one disk sector (512 bytes) will be read and stored in the string called C
C. the whole file content will be read and stored in the string called C
D. one line of the file will be read and stored in the string called C
正解:C
質問 5:
Assuming that the following snippet has been successfully executed, which of the equations are True? (Select two answers)
A. a [0] + 1 ==b [0]
B. b [0] +1 ==a [0]
C. len(a) == len (b)
D. a [0] == b [0]
正解:C,D
質問 6:
What is the expected output of the following snippet?
A. 4
B. 1
C. 3
D. 2
正解:D
質問 7:
Package source directories/folders can be:
A. removed as Python compiles them into an internal portable format
B. rebuilt to a flat form and distributed as one directory/folder
C. converted into the so-called pypck format
D. packed as a ZIP file and distributed as one file
正解:A
質問 8:
What can you do if you don't like a long package path like this one?
A. you can make an alias for the name using the as keyword
B. nothing, you need to come to terms with it
C. you can shorten it to alpha . zeta and Python will find the proper connection
D. you can make an alias for the name using the alias keyword
正解:A