NEW
Font size
WorksheetsPython Functions & Library
Total questions: 12
Worksheet time: 12mins
Consider the following code:
0
1
2
Consider the following code:
1 2 2
2 1 2
4 2 2
What is the output of the following code snippet?
1 3
2 3
The program has a runtime error because x and y are not defined.
3 2
3 3
What is the output of the following piece of code?
4
5
1
An exception is thrown
What is the output of the below program?
x is 50Changed global x to 2Value of x is 50
x is 50Changed global x to 2Value of x is 2
x is 50Changed global x to 50Value of x is 50
None of the mentioned
What is the output of the function shown below (random module has already been imported)?
random.choice('sun')
sun
either s,u or n
u
Error
A package is a folder containing one or more Python modules. One of the modules in a package must be called _______.
__package__.py
init.py
main.py
__init__.py
__main__.py
What is output of following code?
i i i i i i i i……..
m m m m m …..
m n o p q r
No output
What is the output of the code?
-300 -100
200 0
200 100
0 300
What is the value of a, b, c in the given below code?
a, b = c = 2 + 2, ''TutorialsPoint''
a=4, 'TutorialsPoint'
b= 4, 'TutorialsPoint'
c= 4, 'TutorialsPoint'
a=2
b= 'TutorialsPoint'
c=4, 'TutorialsPoint'
a=4
b= 'TutorialsPoint'
c=4, 'TutorialsPoint'
a=4
b= 'TutorialsPoint'
c= NULL
Choose the correct output for this code:
1
2
4
16
256
What is the output of this code?
def func(val1, val2=2, val3=7, val4=1):
return val1**val2**val3
print(func(val2=2, val1=2, val3=4))
256
32768
65536
This code raises an exception
