COMP 200: Elements of Computer Science
Spring 2013

Exam 1 Review

Study Topics

This is just a list of topics to help guide your studying. The list is not in order of importance nor should it be considered a complete list of all topics you should know.

Computational thinking and modeling

Kinds of data

Math operations

List operations

Dictionaries

Functions

Loops

Conditionals

Misc

Sample problems

The following problems are typical of those that will be on the exam. In addition to answering these questions, you should also review the course's online notes and the solutions to the daily exercises and assignments.

The following is a formula for computing compound interest: a = p(1+r/n)n·t, where,

Write a Python function that returns a when given the other values.

Complete the following function that takes a list of numbers [x0, …] and a number n. It returns a list that is [x0n, …].

Complete the following function that returns the number of positive elements in a list.

Complete the following function that takes a list of pairs of symbols, representing a directional relationships from the first element to the second, and returns a dictionary that maps all the first elements of the pairs to a list of all the second elements of the pairs.    Technically, these sorts of relationships constitute something called a "graph", where each value is called a "node" and each directional relationship (the pair) from one node to another node is called and "edge".
Thus make_graph([('a', 'b'), ('b', 'c'), ('c', 'a'), ('a', 'c'), ('c', 'c')]) returns {'a': ['b', 'c'], 'b': ['c'], 'c': ['a', 'c']}

 

Why do we use documentation strings, and what should be described in them?