-
The function can be reused in the program.
-
Using functions has no positive impact on modules in the program.
-
Cannot create own program writers' functions.
-
All of the above answers are correct.
Multiple choice quiz about Python - Part 9
How much do you know about Python functions? Keep testing your knowledge with Quantrimang through the following multiple choice questions!
-
Question 1: Choose the right answer: Which statements are correct when talking about Python functions?
-
Question 2: Which keyword is used to start the function?
-
Fun
-
Define
-
Def
-
Function
-
-
Question 3: What is the output of the program below?
def sayHello():
print('Hello World!')
sayHello()
sayHello()-
Hello World!
Hello World! -
'Hello World!'
'Hello World!' -
Hello
Hello -
There is no right answer
-
-
Question 4: What is the output of the program below?
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)-
3
-
4
-
4 is maximum
-
There is no right answer
-
-
Question 5: What is the output of the program below?
x = 50
def func(x):
print('Giá trị của x là', x)
x = 2
print('Giá trị của x được thay đổi thành', x)
func(x)
print('Giá trị hiện tại của x là', x)-
The current value of x is 50
-
The current value of x is 100
-
The current value of x is 2
-
There is no right answer
-
-
Question 6: What is the output of the program below?
x = 50
def func():
global x
print('Giá trị của x là', x)
x = 2
print('Giá trị của x được thay đổi thành', x)
func()
print('Giá trị hiện tại của x là', x)-
The value of x is 50
The value of x is changed to 2
The current value of x is 50 -
The value of x is 50
The value of x is changed to 2
The current value of x is 2 -
The value of x is 50
The value of x is changed to 50
The current value of x is 50 -
There is no right answer
-
-
Question 7: What is the output of the program below?
def say(message, times = 1):
print(message * times)
say('Hello')
say('World', 5)-
Hello
WorldWorldWorldWorldWorld -
Hello
World 5 -
Hello
World, World, World, World, World -
Hello
HelloHelloHelloHelloHello
-
-
Question 8: What is the output of the program below?
def func(a, b=5, c=10):
print('a bằng', a, 'và b bằng', b, 'và c bằng', c)func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)-
a equals 7 and b equals 3 and c equals 10
a equals 25 and b equals 5 and c equals 24
a equals 5 and b equals 100 and c equals 50 -
a equals 3 and b equals 7 and c equals 10
a equals 5 and b equals 25 and c equals 24
a equals 50 and b equals 100 and c equals 5 -
a equals 3 and b equals 7 and c equals 10
a equals 25 and b equals 5 and c equals 24
a equals 100 and b equals 5 and c equals 50 -
There is no right answer
-
-
Question 9: What is the output of the program below?
def maximum(x, y):
if x > y:
return x
elif x == y:
return 'Các số bằng nhau'
else:
return yprint(maximum(2, 3))-
2
-
3
-
The numbers are equal
-
There is no right answer
-
-
Question 10: Choose the correct answer: Which statement is correct when talking about Docstring in Python?
-
Docstring is the first string immediately after the function title
-
Docstring is optional but should be in a function
-
Docstring is accessed by the __doc__ attribute on the object
-
All of the above answers are correct.
-
4 ★ | 7 Vote
Read More
- Multiple choice quiz about Python - Part 4
- Multiple choice quiz about Python - Part 8
- Multiple choice quiz about Python - Part 1
- Multiple choice quiz about Python - Part 3
- Multiple choice quiz about Python - Part 7
- Multiple choice quiz about Python - Part 10
- Multiple choice test on Python - Part 11
- Multiple choice quiz about Python - Part 5
- eQuiz - VB.NET testing test - Part 2
- Multiple choice test on if else and loops in Python
- eQuiz - Multiple choice test on JDBC - Part 1
- eQuiz - Quiz on Core Java - Part 2
- This is how to create multiple-choice question slides in Canva.
- JAVA P8 test quiz