Which of the following invocations are valid? (Select two answers)
A. rfind("python","r")
B. sorted("python")
C. "python".sort ()
D. "python".index("th")
What is the expected output of the following snippet?
A. 3
B. 1
C. 2
D. the code is erroneous
What is the expected output of the following code?
A. 4
B. 16
C. an exception is raised
D. 1
Which of the following expressions evaluate to True? (Select two answers)
A. 121 + 1 != '!' + 2 * '2'
B. 'AbC' lower () < 'AB'
C. '1' + '1' + '1' < '1' * 3'
D. '3.14' != str(3.1415)
An operator able to perform bitwise shifts is coded as (select two answers)
A. -
B. ++
C. <<
D. >>
What is the output of the following piece of code?
A. ant'bat'camel
B. ant"bat"camel
C. antbatcamel
D. ant bat camel
What can you deduce from the following statement? (Select two answers) str = open('file.txt', "rt")
A. str is a string read in from the file named file.txt
B. a newlina 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
Which of the following lines of code will work flawlessly when put independently inside the inc ( ) method in order to make the snippet's output equal to 3? (Select two answers) A. put (self.prop + vaI)
B. self.put (self.get ( ) + vaI)
C. self.put (get ( ) + vaI)
D. self.put (self.prop + vaI)
The simplest possible class definition in Python can be expressed as:
A. class X:
B. class X: pass
C. class X: return
D. class X: {}