Python List and Nested List Assessment
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Hard
Dhanalakshmi Murali
Used 2+ times
FREE Resource
Enhance your content in a minute
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following list comprehension? numbers = [1, 2, 3, 4, 5] squares = [x**2 for x in numbers]
[1, 4, 9, 16, 25]
[2, 4, 6, 8, 10]
[1, 2, 3, 4, 5]
[2, 4, 8, 16, 25]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which list comprehension creates a list of even numbers from 1 to 10?
[x for x in range(1, 11) if x % 2 == 0]
[x for x in range(1, 11) if x % 2 != 0]
[x for x in range(2, 11, 2)]
[x * 2 for x in range(1, 6)]
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which list comprehension will convert all strings to uppercase?
[str.upper() for str in words]
[str.upper for str in words]
[str.upper(x) for x in words]
[x.upper() for x in words]
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of this list comprehension? [x*5 for x in [1,2,3]]
[5,1,2,3]
[1,2,3,1,2,3,1,2,3,1,2,3,1,2,3]
[[5,10,15]]
[5,10,15]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What's the output of this list comprehension with conditional? [x if x > 2 else 0 for x in [1,2,3,4]]
[1, 2, 3, 4]
[0, 0, 3, 4]
[0, 2, 3, 4]
[1, 0, 3, 4]
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which list comprehension filters out non-numeric strings?
[x for x in ['1', 'a', '2', 'b'] if x.isnumeric()]
[x for x in ['1', 'a', '2', 'b'] if isinstance(x, int)]
[x for x in ['1', 'a', '2', 'b'] if type(x) == int]
[x for x in ['1', 'a', '2', 'b'] if x.isdigit]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which list comprehension creates a list of vowels from a string?
[x for x in "hello world" if x in ['a','e','i','o','u']]
[x if x in 'aeiou' else '' for x in "hello world"]
[x for x in "hello world" where x in 'aeiou']
['aeiou' for x in "hello world"]
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
25 questions
5A - Firewall - aprile 2021
Quiz
•
12th Grade
29 questions
TMK TAHUN 5
Quiz
•
KG - University
30 questions
Quiz Herramientas TIC
Quiz
•
12th Grade
25 questions
JKI_2024
Quiz
•
12th Grade
25 questions
PTS XII - 8
Quiz
•
12th Grade - University
25 questions
Teknologi Layanan Jaringan Media Jaringan
Quiz
•
12th Grade
25 questions
MCS Summer Camp Quizizz
Quiz
•
KG - 12th Grade
25 questions
Types and Components of Computer Systems
Quiz
•
9th - 12th 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
