Multiple choice quiz about Python - Part 10
- Question 1: What are the advantages of using functions in Python?
- Avoid having to repeat code that executes similar tasks.
- Separate complex problems into simpler parts.
- Clear, more manageable code
- All answers are correct.
-
- Question 2: Python has 2 main types of functions, that is:
- Custom function & User defined function
- Built-in function & User defined function
- Built-in function & User function
- System function & User function
-
- Question 3: Where is the function declared?
- Module
- Class
- In another function
- All of the above
-
- Question 4: Where is the element called when the function is declared in a class?
- Module
- Class
- Method
- Another function
-
- Question 5: Choose the correct answer when talking about the function id () in Python?
- Id () returns an object identifier.
- Each object not only has a unique id.
- Both options are true.
- There is no right answer.
-
- Question 6: What is the output of the program below?
def cube(x):
return x * x * x
x = cube(3)
print x
- 9
- 3
- 27
- 30
-
- Question 7: What is the output of the program below?
def C2F(c):
return c * 9/5 + 32
print C2F(100)
print C2F(0)
- 212
32 - 314
24 - 567
98 - There is no right answer
-
- Question 8: What is the output of the program below?
def power(x, y=2):
r = 1
for i in range(y):
r = r * x
return r
print power(3)
print power(3, 3)
- 212
32 - 9
27 - 567
98 - There is no right answer.
-
- Question 9: What is the output of the program below?
def sum(*args):
'''Hàm trả về tổng
của các giá trị'''
r = 0
for i in args:
r += i
return r
print sum.__doc__
print sum(1, 2, 3)
print sum(1, 2, 3, 4, 5)
- 6
15 - 6
100 - 123
12345 - There is no right answer
-
- Question 10: What is the output of the program below?
def printMax(a, b):
if a > b:
print(a, 'là số lớn nhất')
elif a == b:
print(a, 'bằng', b)
else:
print(b, 'là số lớn nhất')
printMax(5, 6)
- 5
- 6
- 6 is the largest number
- There is no right answer
-
4.5 ★ | 2 Vote
You should read it
- Multiple choice quiz about Python - Part 7
- 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
- Multiple choice quiz about Python - Part 9
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.