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
Get step-by-step solutions from verified subject matter experts
