
PYTHON TRAINING 2
Quiz
•
Computers
•
University
•
Hard
Devanjali Relan
Used 1+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
def func(a, b=[]):
b.append(a)
return b
print(func(1))
print(func(2))
[1], [2]
[1], [1, 2]
[1, 2], [1, 2]
[2], [1, 2]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following code snippets correctly creates a generator?
def generator():
yield 1
yield 2
def generator():
return 1
return 2
def generator():
return [1, 2]
def generator():
return (1, 2)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
def multiply(a, b=1):
return a * b
print(multiply(5))
0
5
1
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following code?
x = [1, 2, 3]
y = [4, 5, 6]
z = zip(x, y)
print(list(z))
[(1, 4), (2, 5), (3, 6)]
[(1, 2, 3), (4, 5, 6)]
[1, 4, 2, 5, 3, 6]
Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
def foo(x, y):
return x + y, x - y
result = foo(5, 3)
print(result)
(8, 2)
8, 2
[8, 2]
(8, -2)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
def foo():
try:
return 1
finally:
return 2
print(foo())
1
2
None
Error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
x = [1, 2, 3, 4]
y = [i * i for i in x if i % 2 == 0]
print(y)
[1, 4, 9, 16]
[4, 16]
[2, 4]
[1, 3]
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
21 questions
Tìm hiểu các vùng Văn hóa Việt Nam
Quiz
•
University
20 questions
Redes I_1ra_ 2022-II
Quiz
•
University
20 questions
Examen Parcial de Introducción a la Computación
Quiz
•
University
20 questions
Intoduccion a Excel
Quiz
•
University
20 questions
Dampak sosial informatika
Quiz
•
11th Grade - University
15 questions
Ôn tập phần mềm soạn thảo văn bản Word
Quiz
•
3rd Grade - University
17 questions
ALGORITMA
Quiz
•
8th Grade - University
15 questions
Etapa 3 TIC
Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
22 questions
FYS 2024 Midterm Review
Quiz
•
University
20 questions
Physical or Chemical Change/Phases
Quiz
•
8th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
12 questions
1 Times Tables
Quiz
•
KG - University
20 questions
Disney Trivia
Quiz
•
University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University