Here is a general outline of the key concepts and commands (arranged by topic) that you should know for the midterm.

The exam will have the following sections:

  1. Definitions (5 Points)

  2. Hardware (5 Points)

  3. Information Representation (5 Points)

  4. Conditional Execution (5 Points)

  5. Repeated Execution (5 Points)

  6. Algorithms (5 Points)

  7. Data Structures: Lists (5 Points)

  8. Data Structures: Dictionaries (5 Points)

Each section will consist of a mixture of multiple choice / select all, fill-in-the blanks, matching, ordering, or short answer type questions. For the most part, these questions will resemble the types of questions asked in your Reading quizzes.

Representative, but not Exhaustive

This check list is meant to be representative, rather than exhaustive (ie. there may be questions that show up on the exam that are not shown below).

1. Definitions

You will need to know the definitions of the following terms:

Sample Questions

Identify the term that corresponds to the following definitions:

  1. The standard encoding used to represent letters or text.

  2. An abstraction provided by the operating system to store data on secondary storage.

2. Hardware

You will need to know the following:

Sample Questions

Identify the hardware components best described by the following:

3. Information Representation

You will need to know the following:

Sample Questions

  1. Convert the following binary number into decimal and hexadecimal: 1010

  2. How would you represent the color black in hexadecimal? white? red? green? blue?

4. Conditional Execution

You will need to know the following:

Sample Questions

Given the following code:

if x > 5:
    print('Yes')
elif not x % 2:
    print('Maybe')
else:
    print('No')
  1. What is printed if x is 5?

  2. What is printed if x is 10?

  3. What is printed if x is 3?

5. Repeated Execution

You will need to know the following:

Sample Questions

  1. The Python code below is suppose to count all of the even numbers between 1 and 100 (inclusive) that are also a multiple of 5, but it contains some errors. Identify and fix the errors:

    i = 0
    while i < 100:
        if i % 2 or i % 5:
            total + 1
    print(total)
    
  2. Convert the program above from using a while loop to using a for loop instead.

6. Algorithms

You will need to know the following:

Sample Questions

Given the following code:

def function(data):
    for i in range(1, len(data)):
        if data[i - 1] > data[i]:
            return False
    return True
  1. What is the result of executing function([1, 3, 4, 7])?

  2. What is the result of executing function([0, 6, 5, 2])?

  3. What is the time complexity of this function?

  4. What is this function doing (one sentence description)?

7. Data Structures: List

You will need to know the following:

Sample Questions

Given the following code:

numbers = []
for i in range(10):
    if i % 3 == 0:
        numbers.append(i)
  1. What is the contents of numbers after the for loop?

  2. How would you get the amount of items in numbers?

  3. How would you get the first item in numbers?

  4. How would you get the last item in numbers?

  5. How would you get a sublist of numbers that skips the first item?

8. Data Structures: Dictionary

You will need to know the following:

Sample Questions

Given the following code:

text   = 'Billy bob'
counts = {}

for letter in text:
    if letter in counts:
        counts[letter] += 1
    else:
        counts[letter]  = 1

After executing the code above, what is the result of the following expressions:

  1. len(counts)

  2. counts.keys()

  3. counts['b']

  4. counts['i']

  5. counts['t']