Midterm Exam Information

Written by Nick Troccoli, based on documents by Julie Zelenski, Marty Stepp and others


Friday, February 14th, 12:30PM-2:20PM (in class)


Hewlett 200


Midterm Questions
Midterm Solutions+Stats

All midterm regrade requests must be submitted within 7 days of the date when regrade requests were opened - by 11:59PM PST on Tuesday, February 25, 2020.


The midterm exam will be held during the full class period on Friday, February 14th, 12:30PM-2:20PM. For the midterm exam, there will be no alternate time, except for those with relevant official university athletics or Office of Accessible Education accommodations, so please make sure that you can attend the midterm exam at the specified time before enrolling in the class.

The exams are designed to assess your mastery of the course learning objectives, with a particular emphasis on material that was prominent in the lectures, assignments and labs.

The exam is closed-book. You may bring a double-sided US-Letter-sized (8.5"x11") page of your own prepared notes. The exam will include a reference sheet of essential details such as prototypes for standard library functions (e.g., strcpy, strlen, malloc).

You will take your exam electronically, using our custom BlueBook exam software, which you can run on your computer if you have one. If you do not have access to a laptop for the exam that can run BlueBook, please contact the course staff. You cannot access notes, run other applications, use the Internet, nor use any other electronic devices during the exam.

Material Covered

The midterm is intended to assess your understanding of the content covered in the first half of the course. The coverage is through lab4 and assign4 but not beyond (i.e., midterm will cover neither floating point nor assembly). The priority is on material that figured prominently in the assignments, labs, lecture, and reading (this list is in order of decreasing emphasis).

We highly recommend revisiting the labs and assignments. Each of them contain post-task self-check questions at the end that you can use to review. The K&R and B&O textbooks also contain many exercises if you want additional problems to work.

We'd love to see the Piazza forum come alive in helping everyone do their best on the exam – this is a great place to ask and answer unresolved questions, discuss conceptual issues, share techniques and materials you are finding useful as preparation, and support and encourage each other.

What To Bring

The exam is on your computer. You should bring:

  • Your laptop and charger
  • The device you use for two-step authentication (to submit the exam)
  • your double-sided page of notes
  • A power strip/extension cord (optional, but recommended if you have access to one)


  • The Honor Code: the exam is to be completed individually and without any assistance from a partner or other students. Follow the Stanford Honor Code (see link on main course homepage) during the exam: submit only your own work, do not use unpermitted aids on the exam (see below for permitted aids), and say something to the instructors or students in question to prevent any inappropriate activity conducted by others surrounding the exam.

  • Permitted Materials: During the exam, you may use/reference:

    • a double-sided US-Letter-sized (8.5"x11") page of your own prepared notes.

    • a provided reference page of essential details such as prototypes for standard library functions (e.g., strcpy, strlen, malloc). This is included in the BlueBook exam.

    You are not permitted to use any other materials, such as printouts (notes, slides, code, practice exams, etc.), other textbooks, or electronic devices (iPads, Kindles, calculators, music players, etc.).

  • Grading: For coding questions, the majority of the points are typically focused on the correctness of the code. However, there may be deductions for code that is roundabout/awkward/inefficient when more appropriate alternatives exist. We will reward the simple, direct approach for its good design decisions and such code will likely have fewer correctness issues, so the choice of appropriate design can have a large impact. For example, we expect you to leverage appropriate features from the standard libraries; re-implementing that functionality wastes your valuable time and introduces opportunity for error.

    Note that certain problems may have certain constraints (such as only using certain material, etc.) that you must follow to earn full credit. We reserve the right to deduct points for extremely inelegant or inefficient code that dodges the spirit of the problem.

    You are not required to write #include statements on the exam. Please do not abbreviate any code on the exam (such as writing "x2" next to code to copy it twice). Abbreviated code will not be graded.

    Pseudo-code (writing English sentences and phrases instead of code) will typically earn little to no points. For example, writing "In this part of the code, I want to open the file and read each line and print it" will not earn any points.

    You should include your answer, as well as any scratchwork, in the text area for each problem. An answer to a problem not in the designated answer pages for that problem will not receive any credit.

    Unless otherwise specified, it is fine to write helper functions to implement the required behavior.


BlueBook Software:

Mac Download | Windows Download | Linux Download

IMPORTANT: Once you have downloaded the installer file, install BlueBook wherever you wish on your computer. If you're using a Mac and you get an error saying that the Disk Image is from an unidentified developer, open up the installer file in your finder, and right click it and select "Open." The same window will pop up, but this time you'll have a chance to open it anyway. If you get any popups asking for keystroke or other permissions, please make sure to grant them in order for the exam to administer properly. On Windows, if you get a message that says, "Windows protected your PC," you can click on "More info" and then "Run anyway."

Exam Reference Sheet:

Webpage | PDF
Note: the reference sheet is included as the last "problem" in the BlueBook exam. You will be provided with a hard copy as well during the exam.

Practice Materials:

Guide for how to approach and succeed on CS107 exams.

Practice Midterm 1: BlueBook | PDF | Solutions
Password: starburst
This was the midterm from CS107 Winter 2018. It was written as a 120 minute BlueBook exam (10 minutes more than this quarter).
Note: the practice BlueBook exam is configured with an infinite time limit. You cannot close BlueBook and come back to work on the exam later - you must complete it in one sitting. You cannot submit practice exams - if you'd like to check your answers, leave BlueBook open while you do so. Note that for security reasons, BlueBook disables copy/pasting into or out of BlueBook. You can copy/paste within BlueBook, however.

Practice Midterm 2: PDF | Solutions
This was the midterm from CS107 Fall 2018. It was written as a 110 minute paper exam (same as this quarter).

Practice Midterm 3: PDF | Solutions
This was the midterm from CS107 Fall 2017. It was written as an 80 minute paper exam (30 minutes less than this quarter).

Extra Midterm Practice Problems: PDF | Solutions
This is a compilation of additional practice problems from CS107 Fall 2017 for the various topics covered on our midterm exam.


Based on a handout by Brahm Capoor

BlueBook is a program that can administer electronic exams distributed in a special file format. BlueBook itself does not come with any exams but is rather just an application used to take exams. Your exams, including practice exams, will be distributed as special BlueBook files uploaded to the course website. These exam files are encrypted and cannot be opened without a password, which will be provided to you at the start of the exam, or along with the practice materials. Download these files and keep them wherever you wish on your computer.

Once you have BlueBook installed and an exam downloaded, begin by opening BlueBook. On a Mac, if you get a message saying that you were blocked from opening the app for security reasons, browse to the app in the Finder, right click it and select "Open." The same window will pop up, but this time you'll have a chance to open it anyway. The app should go full screen and allow you to choose the exam file you downloaded earlier. Click the folder icon on the right of the screen and navigate to the exam file and click ‘ok’, followed by ‘Load Exam’. At this point, you’ll be brought to the Exam Start Screen. Fill out your details on this screen, fill in the password and click ‘Start Exam’.

You’ll then be brought to the main Exam View, which allows you to go back and forth between all the questions for the duration of the exam. You can navigate between questions using the toolbar at the top of the window. The text editor provided to you will have syntax highlighting, bracket completion and automatic indenting, but will not allow you to compile your code. The exam will end automatically after the specified duration ends.

screenshot of the BlueBook program showing a sample exam

We know that BlueBook is not the same as working with a compiler as you do on Myth, and we account for that in how we design and grade the exam. We are assessing your ability to think logically and use appropriate problem-solving techniques. We expect you to express yourself in reasonably correct C, but we will be lenient with errors that are syntactic rather than conceptual.

When you are done with your exam – or time has run out – you can begin the submission process for the exam. Do so by clicking the blue ‘Submit’ button in the toolbar. Once time runs out, this process automatically starts. Beginning submission is an irreversible decision, so make sure that you’re confident you’re ready to turn your answers in. Once you confirm that you want to submit, the BlueBook window will shrink and allow you to turn on your internet in order to submit the exam. Importantly, we verify your identity while submitting, so please make sure to have your two-step authentication device with you. Once your submission is successful, you will see a message with a green check mark and a confirmation code of your exam submission, which you should keep for your records in case any issues arise later. At this point, feel free to close BlueBook. Congratulations! You’re done with the exam!

Some final notes about BlueBook:

  • Please make sure that your laptop has at least a few gigabytes of free space before the exam begins. While BlueBook exams certainly don’t take up that much space, we do back up your answers in case your computer crashes and we want to make sure your computer has enough space for these backups.
  • Please come to the exam with a fully charged laptop. While there will be some facilities to charge your laptops during the exam, there will likely not be enough for everyone.
  • BlueBook is capable of detecting if you switch away from the window during the examination. In order to avoid this signal being triggered accidentally, please disable your internet connection and/or notifications before the exam begins. You will have the opportunity to turn them back on when the time comes to submit.
  • Should your laptop crash during the exam, please see a proctor as soon as possible so they can restore your answers and you can continue working. Do not attempt to restart the exam from scratch as this might overwrite your previous answers.