NEW
Font size
WorksheetsScope of Variables in Python
Total questions: 15
Worksheet time: 15mins
What is the output of the following python program?
Error
12
15
1512
What is the output of the following python code?
Error
100
99
101
What is the output of the following python code?
13
10
2
5
What is the output of the following python code?
error
hello
16
16
hello
What is the output of the following python code?
Error
12 4
4 12
4 15
What is the output of the following python code?
1 2 3 4
5 10 15 20
10 20 30 40
5 10 15 40
What is the output of the following python code?
outer
error
inner
outer
outer
inner
error
What is the output of the following python code?
Error
7
8
15
What is the output of the following python code?
I Love Paris in the summer
error
I Love Paris in the summer
I Love Paris in the summer
What is the output of the below python code?
I am looking for a course in Paris!
Only in spring, but London is great as well!
Only in spring, but London is great as well!
I am looking for a course in Paris!
I am looking for a course in Paris!
Only in spring, but London is great as well!
Only in spring, but London is great as well!
Only in spring, but London is great as well!
I am looking for a course in Paris!
Only in spring, but London is great as well!
What is the output of the following python code?
42 17 4 17
42 15 3 4
1 15 3 4
17 4
42 33 17 100
What is the output of the following python code?
x=100
def f1():
global x
x=90
def f2():
global x
x=80
print(x)
100
90
80
error
Read the following Python code carefully and point out the global variables?
y, z = 1, 2
def f():
global x
x = y+z
x
y and z
x, y and z
Neither x, nor y, nor z
How are variable length arguments specified in the function heading?
one star followed by a valid identifier
one underscore followed by a valid identifier
two stars followed by a valid identifier
two underscores followed by a valid identifier
What is the output of this python code?
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
Error
True
False
None
