Which of the following statement are true? (Select two answers)
A. closing an open file is performed by the closefile ( ) function
B. the second open ( ) argument describes the open mode and defaults to `w'
C. if open ( ) `s second argument is `r' the file must exist or open will fail
D. if open ( )'s second argument is `w' and the invocation succeeds, the previous file's content is lost
What is the expected behavior of the following code?
A. It outputs 123
B. it raises an exception
C. it outputs 321
D. it outputs 6
Assuming that the following inheritance set is in force, which of the following classes are declared properly? (Select two answers)
A. class Class_4 (D, A) : pass
B. class Class_1(C,D): pass
C. class Class_3(A,C): pass
D. class Class_2(B,D): pass
A property that stores information about a given class's super-classes is named:
A. _upper_
B. _bases_
C. _ancestors_
D. _super_
What is true about Python class constructors? (Select two answers)
A. the constructor's first parameter identifies an object currently being created
B. the constructor cannot use the default values of the parameters
C. the constructor can be invoked directly under strictly defined circumstances
D. super-class constructor is invoked implicitly during constructor execution
Can a module run like regular code?
A. yes, and it can differentiate its behavior between the regular launch and import
B. it depends on the Python version
C. yes, but it cannot differentiate its behavior between the regular launch and import
D. no. it is not possible; a module can be imported, not run
A variable stored separately in every object is called:
A. there are no such variables, all variables are shared among objects
B. a class variable
C. an object variable
D. an instance variable
Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Choose two.)
A. isinstance (obj_b,A)
B. A.VarA == 1
C. obj_a is obj_aa
D. B.VarA == 1
What is the expected output of the following code?
def foo(x,y):
return y(x) + (x+1) print (Foo(1,lambda x: x*x))
A. 3
B. 5
C. 4
D. an exception is raised
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) = 'Object1
B. Class A.__module__ == ' main__'
C. len (ClassB.__bases__) == 2
D. __name__== '__main__'