Python Generators

Quiz
•
Computers
•
10th Grade - University
•
Medium
Dr Sonia Mitchell
Used 52+ times
FREE Resource
10 questions
Show all answers
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the generator expression?
[x**2 for x in my_list]
(x**2 for x in my_list)
{x**2 for x in my_list}
x**2 for x in my_list
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
my_list = [1, 3, 6, 10]
list_ = [x**2 for x in my_list]
generator = (x**2 for x in my_list)
print(list_)
print(generator)
list object address and [1, 9, 36, 100]
[1, 9, 36, 100] and list object address
[1, 9, 36, 100] and generator object address
generator object address and [1, 9, 36, 100]
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
my_list = [2, 4, 9, 14, 17]
value = sum(x**2 for x in my_list)
value
586
59
Error
Nothing is printed
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A generator in Python makes use of ________ keyword.
Gen
Return
Yield
All the above
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Generator in Python is not a subclass of Iterator.
True
False
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
State whether the below statement is True or False.
issubclass(collections.Iterator,types.GeneratorType)
True
False
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Technical Terms - Internet (A-Z) - Traceback

Quiz
•
12th Grade
10 questions
Graficas con matlab y pandas

Quiz
•
University
10 questions
ArrayLists

Quiz
•
11th - 12th Grade
10 questions
Stack

Quiz
•
University
15 questions
Queues

Quiz
•
11th Grade - Professi...
8 questions
Module 4-Inter vlan routing

Quiz
•
9th Grade - University
10 questions
Deep Learning: Generative Models

Quiz
•
University
5 questions
DSA day 4

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade