
Python Programming Quiz
Quiz
•
Information Technology (IT)
•
2nd Grade
•
Hard
Thủy Nguyễn
Used 1+ times
FREE Resource
Enhance your content in a minute
21 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? def func(x, y=[]): y.append(x) return y print(func(1)) print(func(2))
a) [1], [2]
b) [1], [1, 2]
c) [1, 2], [1, 2]
d) [2], [2, 2]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `itertools` module provide?
a) A collection of tools for handling iterators
b) A collection of tools for working with images
c) A collection of tools for working with files
d) A collection of tools for working with databases
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about Python decorators is true?
a) Decorators can only be applied to functions
b) Decorators can be used to modify classes and functions
c) Decorators are used to create new functions
d) Decorators cannot accept arguments
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following methods is used to read all the lines of a file into a list in Python?
a) `readlines()`
b) `read()`
c) `readline()`
d) `readall()`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? class MyClass: def __init__(self, value=0): self.value = value obj1 = MyClass(5) obj2 = MyClass() print(obj1.value, obj2.value)
a) 5 0
b) 0 5
c) 5 5
d) 0 0
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `zip()` function do in Python?
a) Combines elements from two or more iterables into tuples
b) Compresses a string
c) Encrypts data
d) None of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? x = [1, 2, 3, 4] y = [5, 6, 7, 8] z = [a + b for a, b in zip(x, y)] print(z)
a) [1, 2, 3, 4, 5, 6, 7, 8]
b) [6, 8, 10, 12]
c) [5, 7, 9, 11]
d) [2, 4, 6, 8]
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
16 questions
Protección y Privacidad
Quiz
•
1st - 5th Grade
22 questions
3° trimestre 2 A história e recursos do Python
Quiz
•
2nd Grade
20 questions
STUDY INFORMATICS FROM HOME GRADE II
Quiz
•
2nd Grade
22 questions
Tin5. Ôn thi cuối HK1 - PĐ1
Quiz
•
1st - 5th Grade
25 questions
Software Testing in Java
Quiz
•
1st Grade - University
20 questions
Tinkercad CodeBlocks III
Quiz
•
1st - 5th Grade
18 questions
Avvio del Computer
Quiz
•
2nd Grade
21 questions
"ИНФО 2-АЙ 1-АПТА VPS"
Quiz
•
1st - 5th Grade
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
MINERS Core Values Quiz
Quiz
•
8th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
Discover more resources for Information Technology (IT)
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
10 questions
Verbs
Quiz
•
2nd Grade
7 questions
Compare and Classify Quadrilaterals
Lesson
•
2nd - 4th Grade
10 questions
2-Digit Addition with Regrouping
Quiz
•
2nd Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
30 questions
Multiplication Facts 1-12
Quiz
•
2nd - 5th Grade
16 questions
American Revolution
Interactive video
•
1st - 5th Grade
20 questions
Sentence Fragments and Complete Sentences
Quiz
•
2nd - 4th Grade
