Multiple choice quiz about Python - Part 9
- Question 1: Choose the right answer: Which statements are correct when talking about Python functions?
- 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.
-
- 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 y
print(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
You should read it
- Multiple choice quiz about Python - Part 7
- Multiple choice quiz about Python - Part 10
- Multiple choice quiz about Python - Part 5
- Multiple choice quiz about Python - Part 6
- Multiple choice test on Python - Part 11
- Multiple choice quiz about Python - Part 2
- Multiple choice quiz about Python - Part 8
- Multiple choice quiz about Python - Part 1
May be interested
- eQuiz - VB.NET testing test - Part 2in the previous article, i showed you the first part of the vb.net test. and this time, we will continue with part 2 of this popular quiz series on programming languages, the whole test will have 15 questions with unlimited response time.
- eQuiz - Multiple choice test on JDBC - Part 1in the quiz below, we will introduce you to part 1 of the jdbc basic knowledge test series with 15 questions.
- eQuiz - Quiz on Core Java - Part 2in the quiz below, you will be able to try out part 2 of the series related to core java - one of the most popular programming languages today. in total, the test will have 15 questions in the form of multiple choice, with an unlimited response time ...
- JAVA P8 test quizif you are interested in learning about the java programming language, the following quiz of network administrator will provide you with a lot of useful knowledge for your learning.
- Testing of computer architecture - Part 2next to this topic, in the quiz below will be more challenging, let's start.
- What do you know about iPhone? Doing this test will be clear (part 2)do multiple-choice questions about iphone in part 1 make it difficult for you? try the next 10 questions about the iphone.
- Multiple choice questions about Photoshop - Part 1a set of multiple-choice questions about photoshop for you to try and understand.
- [QUIZ] Test your understanding of SQL - Part 5multiple-choice questions on sql help you familiarize and review useful knowledge for work and learning sql language.
- What do you know about iPhone? Doing this test will be clear (part 1)as a smartphone user, maybe also holding the iphone in your hand, what do you really know about this apple pet's baby? let's take the quiz below to answer that question.
- [QUIZ] Test your understanding of SQL - Part 4let's try our knowledge with multiple choice questions about sql database management system.