
Python Programming Quiz
Authored by Thủy Nguyễn
Information Technology (IT)
2nd Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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]
Access all questions and much more by creating a free account
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
Already have an account?
Similar Resources on Wayground
20 questions
Informatique et nouvelles technologies, le saviez-vous ?
Quiz
•
1st Grade - University
20 questions
UH TREE GRAPH KELAS 9
Quiz
•
2nd Grade
20 questions
Prova Ciência da Computação
Quiz
•
2nd Grade
16 questions
Cyber_quizz_3eme
Quiz
•
1st - 5th Grade
25 questions
PTS TIK 8D
Quiz
•
2nd Grade - University
20 questions
مسابقة تحدي المعلومات -صف 2
Quiz
•
2nd Grade
20 questions
Grade 2-Term 2(Revision)TGAA_KA
Quiz
•
2nd Grade
26 questions
TIN HỌC 5
Quiz
•
1st - 5th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
14 questions
Contractions
Quiz
•
2nd Grade
10 questions
Exploring Rosa Parks and Black History Month
Interactive video
•
1st - 5th Grade
20 questions
Counting Coins
Quiz
•
2nd Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
19 questions
Subject-Verb Agreement
Quiz
•
2nd - 5th Grade
13 questions
Fractions
Quiz
•
1st - 2nd Grade
12 questions
2-Digit Subtraction with Regrouping
Quiz
•
2nd Grade
14 questions
Fractions
Quiz
•
2nd - 3rd Grade