The C assessment exam has used questions on specific topics, often those in the following list.
- Simple and nested loops.
- Bit operations
- Linked list
- Binary trees
This page is an attempt to identify such a set of topics for Python. The focus is on fundamentals, not modules. No imports allowed. For each problem type, some topics are listed. Then example problems are given (or will be someday), and split into three categories: Easy, Medium, and Hard. A typical exam might use one each from the Easy and Hard categories, and three from the Medium category.
Basic (BASIC) level programs
- Basic data types: string, numeric (not Complex), Boolean
- Reading and writing: input and print.
- Type conversions: string to/from numeric.
- Algebraic expressions. Assignment statements.
- Easy: Celsius to Fahrenheit conversion.
- Medium: Temperature conversion with inputs like: 30F, 40C, etc.
- Harder: Real solutions to quadratic equations.
Fundamental Data Structures
List, tuple, set, frozenset, dictionary
- Creation of, and basic operations on, all five data structures.
- Selecting the appropriate data structure.
- Easy: Find words common to two lists, read from 2 column data .le.
- Medium: Find words common to two of three lists.
i# Medium: Multiple choice? A few scenarios, pick the data structure: Example: Looking up words in a foxed list of words. Which of the five do we use? Or, looking up words in a changing list of words. Looking up and counting frequencies for a list of words.
- Harder (Code golf with comprehensions?) Sort, max, min problems. Example: Sort a list of words by the number of vowels in the word. Example: Find the number (in a list) with the most one bits in its binary representation.
- Basic definition.
- Test knowledge of builtin functions.
- Decorators? Move this to classes?
- Easy: Defining simple functions. Position and named parameters.
- Medium: Recursion with memoization (functools not allowed).
- Hard: Functions returning functions: return a linear or quadratic function given coefficients.
Iterators and Generators
- Using iterators: for, next, iter.
- Common iterators: lists, tuples, dictionaries, range, zip, enumerate, .le descriptors, et cetera.
- Creating iterators: class-based iterations (move to classes?).
- Easy: nested loops, one of Rob’s patterns of characters.
- Medium: nested loops, one of Rob’s harder patterns.
- Medium: Given class definition: write a method to do something.
- Hard: (generators) Construct generator for words from text .le.
- Basic definition.
- Dunder methods, class based iterators.
- Inheritance. Decorators.
- Privacy conventions.
- Easy: De.ne a Point class; add a few methods for distance, norms.
- Medium: Binary tree class, with the usual methods, a couple dunders (in, len, str, add, eq, invert).
- Hard: Subset frequency counting trie. Given a big set, .nd all subsets that appear as subsets in at least r of the sets.