Question
Some multiple choice questions for linked structures and iterators. 6. If you write a _ _len_ _ method for a container class, how is that
Some multiple choice questions for linked structures and iterators.
6. If you write a _ _len_ _ method for a container class, how is that method called for an instance b of the class?
a) b.len()
b) len(b)
c) b._ _len_ _()
d) either len(b) or b._ _len_ _()
8. If you want to write an iterator that uses the yield statement, what methods must to write?
a) the _ _iter_ _ and the next methods
b) only the _ _iter_ _ method
c) only the next method
d) you cannot write an iterator using the yield statement
9. If you do not use the yield statement to write an iterator, what methods must you write?
a) the _ _iter_ _ and the next methods
b) only the _ _iter_ _ method
c) only the next method
d) you cannot write an iterator using the yield statement
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started