Question 21
What would you used instead of XXX if you want to check weather a certain 'key' exists in a dictionary called dict? (Choose two.)
A. 'key' in dict
B. dict ['key'] != None
C. dict.exists ('key')
D. 'key' in dict.keys ( )
Question 22
You need data which can act as a simple telephone directory. You can obtain it with the following clauses (Select two relevant variants; assume that no other items have been created before)
A. dir={'Mom': 5551234567, 'Dad': 5557654321}
B. dir= {'Mom': '5551234567', 'Dad': '5557654321'}
C. dir= {Mom: 5551234567, Dad: 5557654321}
D. dir= {Mom: '5551234567', Dad: '5557654321'}
Question 23
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 in cannot differentiate its behavior between the regular launch and import
D. no, it is not possible; a module can be imported, not run
Question 24
Select the valid fun() invocations:(Choose two.)
A. fun (b=1)
B. fun (a=0)
C. fun (b=1, 0)
D. fun (1)
Question 25
A file name like this one below says that:(Choose three.)
services, cpython 36.pyc
A. the interpreter used to generate the file is version 3.6
B. it has been produced by CPython
C. it is the 36 version of the file
D. the file comes from the services.py source file
Question 26
What is the expected behavior of the following snippet?It will:
A. cause a runtime exception
B. print 1
C. print 0, [1]
D. print [1]
Question 27
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 alias 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 as keyword
Question 28
What is the expected output of the following code?
A. abcef
B. The program will cause a runtime exception/error
C. acdef
D. abdef
Question 29
What is the expected output of the following code?
A. 21
B. 2
C. 3
D. 12
Question 30
What is the expected behavior of the following snippet?It will:
A. cause a runtime exception on line 02
B. cause a runtime exception on line 01
C. cause a runtime exception on line 03
D. print 3