Python Week 2
Graded Assignment
Multiple Choice Questions 🧠
Common data for the next 4 questions 🔗
Consider the below code.
|
|
Try playing around in this python tutor link for answering the questions.
1) What is the total number of objects that were referenced by the variables in the given code during the execution?
2) What is the total number of objects that were referenced by the variables in the given code at the end of the execution?
3) What is the total number of variables refering to the same object as variable b
(including b
) at the end of the execution of the given code?
4) Select the variable(s) that are refering to the same object as a
at some point of time during the execution of the above code.
b
c
d
e
f
5) Assume s
is a str
, if the output of print(s)
is The next line char is \\n
, then select the possible the value(s) of s
.
"""The next line char is \\n"""
"The next line char is \\\\n"
'The next line char is \\n'
'The next line char is \\\\n'
6) Assume s
is a str
, if the output of print(s)
is given below.
|
|
Select the possible the value(s) of s
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7) Select the string(s) that are equal to "000500"
.
f"{500:06}"
f"{500:03}"
"0"*3+500
0*3+"500"
"0"*3+"500"
8) Consider the below code block.
|
|
9)
|
|
10)
|
|
24)
|
|
25)
|
|