Midterm Guide

Midterm and Solutions (added October 24, 2023)

[exam] [solution]

Basics

Date: October 19, 2023
Time: 7:30PM - 9:30PM (2 hours)
Location: MBH Room 220
Format: on paper
Questions might involve:

  • True/False
  • Multiple choice
  • Fill-in-the-blank
  • Writing code
    • From scratch
    • Fixing bugs in existing code
    • Re-ordering code to create a working function

Which resources are allowed for the exam? I will print the python cheatsheet that is on the official practice exam for each student. You may also bring one page of 8.5x11 paper with notes (double sided) to the exam. Otherwise, the exam is closed book, closed notes, closed computer, closed calculator, etc.

How to Study

The best way to study for this exam is to try a lot of practice questions. Just reading over your notes or reading over solutions to practice questions probably will not lead to success on the exam.

Official Practice Exam

I am providing a copy of the CS 145 exam from Fall 2022 as a practice exam. I have replaced a couple of questions as necessary based on the order in which we covered material.

I recommend taking this practice exam as you would the real exam. Set aside 2.5 hours (NOTE: this exam was 2.5 hours not 2), start a timer, and close your notes. When you are done, compare your answers to the provided answer key and score your exam. This will give you an idea of what you need to study more.

[exam] [solution]

PrairieLearn

If there are PrairieLearn problems that you have not yet solved, they are a good way to study for the exam.

Additional Practice Exams

There are six CS 150 sample exams availabe on the CS 150 website. The notes below indicate problems that either you should not try to solve or that you will need some additional information to solve (based on the order in which we are covering material). Note that CS 150 covers recursion later in the semester.

I have done my best to include all such problems on this list, but it’s possible that I missed something. If you see a problem that isn’t listed here that seems outside of the scope of what we have talked about, please post on edstem and I can take a look.

Sample Exam 1 (F16)
[exam] [solution]

List of problems that you shouldn't try
  • 1b (you might be able to do this, but we have spent less time on the random library)
  • 2b/c/d (we haven’t talked about slicing with :: and some of these string operations)
  • 5c (we haven’t talked about some of these string operations)
  • 5d (we haven’t talked about nested lists)
  • 5f (we haven’t talked about files)
  • 7 (we haven’t talked about files)
  • 7: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file. Also, ignore done().

Sample Exam 2 (F17)
[exam] [solution]

List of problems that you shouldn't try
  • 1b (you might be able to do this, but we have spent less time on the random library)
  • 2b/c/d (we haven’t talked about slicing with :: and some of these string operations)
  • 3 (we haven’t talked about ::)
  • 4d (we haven’t talked about .split() or list())
  • 4f (we haven’t talked about .find())
  • 5b: you can solve this, but note that sorted(lst) returns a sorted version of lst
  • 6 (we haven’t talked about files)
  • 8: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file. Also, ignore done().

Sample Exam 3 (F18)
[exam] [solution]

List of problems that you shouldn't try
  • 1a (we haven’t talked about imports with this level of depth)
  • 1b (you might be able to do this, but we have spent less time on the random library)
  • 2b/c/d (we haven’t talked about slicing with :: and some of these string operations)
  • 4a (we haven’t talked about using the list function)
  • 4d (we haven’t talked about nested loops)
  • 5b: you should be able to solve this, just know that .lower() turns a string into it’s lowercase version
  • 6 (we haven’t talked about files)
  • 7: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file.

Sample Exam 4 (F19)
[exam] [solution]

List of problems that you shouldn't try
  • 1b (you might be able to do this, but we have spent less time on the random library)
  • 2b (we haven’t talked about :: in slicing)
  • 2c (we haven’t talked about .lower(), although you can probably guess what it does)
  • 2d (we haven’t talked about :: in slicing)
  • 4a (we haven’t talked about the sorted function, although you might be able to guess what it does)
  • 4e (we haven’t talked about nested loops)
  • 6 (we haven’t talked about files)
  • 7: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file.

Sample Exam 5 (F21)
[exam] [solution]

List of problems that you shouldn't try
  • 1c (you might be able to do this, but we have spent less time on the random library)
  • 2b (we haven’t talked about :: in slicing)
  • 2c (we haven’t talked about some of the string operations, although you can probably guess what they do)
  • 4e (we haven’t talked about nested loops)
  • 4h (we haven’t talked about nested lists)
  • 6 (we haven’t talked about files)
  • 7: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file.

Midterm Exam (F22)
[exam] [solution]

List of problems that you shouldn't try
  • 1c (you might be able to do this, but we have spent less time on the random library)
  • 2b (we haven’t talked about :: in slicing)
  • 2c (we haven’t talked about .lower(), although you can probably guess what it does)
  • 4h (again, you might be able to do this, but we haven’t taked about nested lists and you won’t be asked about them on our exam)
  • 6 (we haven’t talked about files)
  • 7: you can solve this, but note that the syntax is a little bit different than what we have seen. We have seen turtle.forward instead of just forward, etc. They work the same when from turtle import * is at the beginning of the file.