Python novice/intermediate/expert assessment

Jun 17, 2013 • Luke Lee

Novice question:

Select all of the following Python data structures that do NOT have guaranteed
order when looping with a standard ‘for’ loop:

a) List
b) Set
c) Tuple
d) Dict
e) String

Experienced question:

Which of the following is NOT a good usage of the __slots__ class variable in
Python?

a) To save memory for a custom object
b) To prevent dynamic attribute creation for an object
c) To simulate a C struct ‘type’ when reading data from a binary file
d) To improve the speed of attribute lookup for an object