Page 1 out of 10. Viewing questions 1-15 out of 147
Question 1
What is true about Python packages? (Select two answers)
A.
the__name__variable content determines the way in which the module was run
B.
a package can be stored as a tree of sub-directories/sub-folders
C.
__pycache__is the name of a built-in variable
D.
hashbang is the name of a built-in Python function
Answer:
B, C
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 2
A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access the variable? (Select two answers)
A.
import pyvar from pymod pyvar = 1
B.
from pymod import pyvar = 1
C.
from pymod import pyvar pyvar ()
D.
import pymod pymod.pyvar = 1
Answer:
AD
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 3
Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers) import random v1 = random. random() v2 = random. random()
A.
len(random.sample([1,2,3],2)) > 2
B.
v1 == v2
C.
random.choice([1,2,3]) >=1
D.
v1 >= 1
Answer:
B, C
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 4
With regards to the directory structure below, select the proper forms of the directives in order to import module_ a. (Select two answers)
A.
import pypack.module_a
B.
import module_a from pypack
C.
import module_a
D.
from pypack import module_a
Answer:
AD
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 5
Which one of the platform module functions should be used to determine the underlying platform name?
A.
platform.uname ()
B.
platform.platform ()
C.
platform.python_version()
D.
platform.processor()
Answer:
C
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 6
What is the expected output of the following code?
A.
True
B.
0
C.
False
D.
None
Answer:
A
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 7
What is true about the following snippet? (Select two answers)
A.
the code will raise an unhandled exception
B.
the string I feel fine 'will be seen
C.
the string it's nice to see you will be seen
D.
the string what a pity will be seen
Answer:
BD
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 8
What is the expected behavior of the following code?
A.
it outputs 2
B.
the code is erroneous and it will not execute
C.
it outputs 1
D.
it outputs 3
Answer:
A
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 9
Which of the following snippets will execute without raising any unhandled exceptions? (Select answers) A) B) C) D)
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Answer:
BCD
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 10
What is the expected behavior of the following code?
A.
it outputs 1
B.
it outputs 2
C.
the code is erroneous and it will not execute
D.
it outputs 3
Answer:
B
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 11
What is the expected behavior of the following code?
A.
it outputs error
B.
it outputs list assignment index out of range
C.
the code is erroneous and it will not execute
D.
it outputs <class ' IndexError’ >
Answer:
B
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 12
Which of the following expression evaluate to True? (Select two answers)
A.
len('\'•) == 1
B.
len(""" """) == o
C.
chr(ordCA') + 1) == 'B'
D.
ord("Z") - ord("z") -- ord("0")
Answer:
B
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 13
What is the expected behavior of the following code?
A.
it raises an exception
B.
it outputs True
C.
it outputs False
D.
it outputs nothing
Answer:
B
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 14
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)
Answer:
A, D
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 15
Which of the following expressions evaluate to True? (Select two answers)