Show List
Quiz - Python - 5
Select the right answer for below questions:
What is the output of the following code:
x = 5
y = 6
z = x + y
print(z)
x = 5
y = 6
z = x + y
print(z)
11
10
9
8
11
What is the correct syntax to create a function in Python?
function name():
def name():
def name(self):
def(name):
def name():
What is the correct way to access elements in a list in Python?
list.get(index)
list[index]
list(index)
list.element(index)
list[index]
What is the output of the following code:
x = [1, 2, 3, 4, 5]
y = x.pop(2)
print(y)
x = [1, 2, 3, 4, 5]
y = x.pop(2)
print(y)
2
3
4
5
3
What is the correct syntax to import a module in Python?
include module_name
import module_name
import module.name
require module_name
import module_name
What is the output of the following code:
x = [1, 2, 3, 4, 5]
y = sum(x)
print(y)
x = [1, 2, 3, 4, 5]
y = sum(x)
print(y)
15
10
5
20
15
What is the output of the following code:
x = "Hello, World!"
print(len(x))
x = "Hello, World!"
print(len(x))
12
11
10
9
12
What is the output of the following code:
x = 5
y = 6
z = x + y
print(z)
x = 5
y = 6
z = x + y
print(z)
11
10
9
8
11
What is the correct way to access elements in a dictionary in Python?
dict.get(key)
dict(key)
dict[key]
dict.element(key)
dict[key]
What is the output of the following code:
x = [1, 2, 3, 4, 5]
y = x.pop()
print(y)
x = [1, 2, 3, 4, 5]
y = x.pop()
print(y)
1
5
4
3
5
Submit
Retry
{"qz1-444788":"11","qz1-444789":"def name():","qz1-444790":"list[index]","qz1-444791":"3","qz1-444792":"import module_name","qz1-444793":"15","qz1-444794":"12","qz1-444795":"11","qz1-444796":"dict[key]","qz1-444797":"5"}
Leave a Comment