Midterm Exam Information

Written by Lisa Yan, Nick Troccoli, and Chris Gregg, based on documents by Julie Zelenski, Nick Bowman and others

Date/Time:

Tuesday/Wednesday, February 8th/9th (any 2-hour slot between 8am Tuesday and 10pm Wednesday)

Location: Online



Overview

The midterm exam is intended to gauge your comfort and facility with the course material so far, as well as assess your mastery of the course learning objectives. Since the course topics build on each other, confirming you have a solid grasp of the foundational material now ensures you are equipped to tackle the later concepts to come in the course.

We provide the exam as a tool to take stock of where you're at and see how much you've learned in the first half of the course, as well as what work you have left to do. It also contributes a small but meaningful contribution to your course grade (10%), which we hope will inspire you to use this checkpoint opportunity wisely!

The exam has a particular emphasis on material that was prominent in the lectures, assignments and labs.

Please make sure to thoroughly read all information contained on this page to ensure you understand the midterm logistics, requirements and restrictions.

Logistics

The exam is open-book. You will have access to an additional reference sheet of essential details such as prototypes for standard library functions (e.g., strcpy, strlen, malloc).

Course staff will do our best to check Ed frequently to answer clarification questions. We cannot guarantee immediate feedback from Ed posts.

You will take your exam electronically, using an online quiz-administration website. The link will be provided prior to the exam, but the exam won't open up until 8am PDT.

The exam is strictly individual work. If we determine that any students worked together or shared any information about the exam during the exam hours (this is easier to find out than you think), we will forward the information to the Office of Community Standards, and those students will likely fail the course and have other Honor Code penalties.

During the exam, you may use/reference:

  • a provided reference page of essential details such as prototypes for standard library functions (e.g., strcpy, strlen, malloc).
  • any resources you have from the course (lecture slides, assignment/lab/lecture code, textbook, reader, etc.), and other information online provided:
    • you do not search for information related to the questions themselves. For example, let's say there was a bitwise question about reversing the bits in a number. You are not allowed to search online for "how to reverse the bits in a number."
    • you do not post requests for help online. This seems obvious, but we wanted to be clear about it.
    • you do not discuss the exam with anyone while you are taking it.

The exam may be a mix of short answer, multiple choice, code reading, code writing, etc. questions.

If you want to try out a practice exam in the same format as the midterm, there is a "Practice Midterm" available below to give you a sense of what the interface and process is like.


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 the topics relevant for lab4 and assign4 but not beyond (i.e., through generics, but not floating point numbers). Yes, we realize that you probably haven't made it too far into assignment 4. But, it would be a good idea to start working on it as part of your preparation. Material on generics will be slightly less heavily emphasized than other topics as assign4 is not due until after the exam, and you are not required to have completed any of assign4 before the exam.

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 discussion forum come alive in helping everyone make the most of this opportunity to review what we've covered so far and rock the midterm – 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.


Taking the Exam

You can take the exam anywhere, provided that you are not in contact with other students in the class, nor is anyone else helping you.

If you have questions during the exam, post a private post on Ed. We will do our best to get to the questions as soon as we can.

The computer will enforce a two hour time limit from when you begin the exam (unless you have OAE accomodations, which will be built in to the time). Once the time is up, you won't be able to go back to see your answers again until after the exam is complete.

You should submit your answers frequently -- if you don't submit the answers and your comptuer crashes, you may have to re-do them (please let us know if something like that happens).

You will be able to see the result of compiling your code, but you won't be able to run your code. You should strive to have no compilation errors in your code.


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, and say something to the instructors or students in question to prevent any inappropriate activity conducted by others surrounding the exam.

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 or 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. These constraints are not intended to make things difficult; typically, we are trying to guide you in the direction of a more straightforward solution. If you disregard these instructions, you are likely to lose points, either for not meeting the problem specification and/or for errors introduced when attempting a convoluted alternative. We reserve the right to deduct points for extremely inelegant or inefficient code that dodges the spirit of the problem.

  • Please do not abbreviate any code (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 can include comments in your code for clarity, but it is not necessary.
  • Unless otherwise specified, it is fine to write helper functions to implement the required behavior.
  • Style and decomposition are secondary to correctness. Unlike the assignments where we hold you to high standards in all areas, for an exam, the correctness of the answers dominates the grading. Decomposition and style are thus somewhat de-emphasized. However, good design may make it easier for you to get the functionality correct and may require less code, which takes less time and provides fewer opportunities for error. Comments are never required unless specifically indicated by a problem. When a solution is incorrect, commenting may help us determine what you were trying to do when we attempt to give partial credit.
  • We are lenient on syntax. We won’t trouble you about most small syntax errors (forgetting semicolons or spaces, for example) as long as your intentions are clear. Having said that, beware that if your syntax errors cause ambiguity (e.g. very unclear curly braces), we might not get the correct meaning. Additionally, there are subtleties that matter immensely, e.g., a int** is just one character different than int*, yet there is a world of difference between the two!
  • The majority of the points for a problem will be reserved for grading the critical core of the code. For example, if we ask you to write a function that processes a generic array, only a tiny fraction of the points will be allocated to tasks such as initializing the counter or iterating over the right bounds, while the bulk of the points will be gained or lost in the tricky details of whether you correctly handle the void*s. Being off-by-one in the loop is a tiny deduction, but being a level of indirection off or applying the wrong cast is a larger issue. Be sure to focus your attention accordingly!

Downloads

Exam Reference Sheet:

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

Practice Materials:

Note that the practice exams below were given out after assign4 was completed, meaning they emphasized generics slightly more heavily than the midterm will.

Practice 1: PDF | Solutions | Online
This was the midterm from CS107 Winter 2018. It was written as a 120 minute closed-book BlueBook (electronic) exam. Click here to take the exam in the same format that the real exam will be in.

Practice 2: PDF | Solutions
This was the midterm from CS107 Fall 2018. It was written as a 110 minute closed-note paper exam.

Practice 3: PDF | Solutions
This was the midterm from CS107 Fall 2017. It was written as an 80 minute closed-note paper exam.

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

Still More Practice Problems: PDF | Solutions
These are practice problems written in Winter 2021 by a former CS107 and CS107A CA, Andrew Benson. These were given out in preparation for the open-book open-resource mid-quarter assessment given that quarter.


Midterm Strategies

For the midterm, answering the questions is typically going to require good comprehension of the foundational concepts and the ability to analyze and apply them in a given situation. We are evaluating that not only did you successfully complete the assignments and labs, but that you came away with a comprehension you can demonstrate. We generally do not ask details that can/should be looked up on demand ("How do you printf a number in hexadecimal number padded to 8 digits?"). Many questions will ask you to write short passages of C code. Other questions may ask you to analyze C code: to trace its behavior, to compare or contrast two versions, identify and fix flaws, or describe a memory layout. Others may ask you short questions about material or code. There may also be short-answer thought questions that ask you to reason about system behavior, coding tasks, numeric representation and limitations, performance tradeoffs, and the like.

Before the exam

The long view. The mastery we are looking to assess with the exams isn't created by a night of cramming, it is built up throughout the quarter. Make it a priority to monitor your own progress and use our post-task self-checks listed at the end of each lab/assignment to identify holes or confusion to be shored up before moving on. In the ideal situation, you have established solid understanding of the material and the only exam preparation needed is practice applying your skills under exam-like conditions.

Make your notes sheet as part of exam prep. Reviewing topics and determining what information is worth including on your reference page(s) will remind you of where we've been and help you take stock of your comfort level with the course topics. Use this opportunity to identify any areas on which you feel weak and resolve dangling issues before heading into the exam.

Practice in simulated conditions. A good way to study for the programming problems is to take a problem (from lecture, lab, textbook) and write out your solution under test-like conditions. This is much more valuable than a passive review of the problem and its solution, when it becomes too easy to conclude “ah yes, I would have done that,” only to find yourself adrift during the real exam when there is no provided solution to guide you!

Get your questions answered. If there is a concept you’re a bit fuzzy on or you’d like to check your answer to a chapter exercise, or you wonder why a solution is written a particular way, get those questions answered before the exam. Swing by Helper Hours or post on the discussion forum; we’re happy to help!

During the exam

Scan all the problems first. Quickly peruse all questions before starting on any one. This allows you to “multitask”—as you are writing the more mundane parts of one answer, your mind can be brainstorming strategies or ideas for another problem in the background. You can also sketch out how to allocate your time between questions in the first pass.

Spend your time wisely. Don't get stuck on any particular problem. You'll earn more points from reasonable efforts across all problems than by perfecting one answer at the cost of leaving others blank. Take into account the point value assigned to each question when budgeting your time. Be conscious of which details are worth slowing down to get it right (e.g. allocating memory, getting the right typecast, correct pointer math, and so on) and which tasks can do with just a quick first draft (e.g. an off-by-one loop index or forgetting to initialize a counter).

Ask a question rather than answer the wrong one. If you are uncertain about what a question is asking or find some part of the question ambiguous, it's worth your time to ask the course staff for a clarification so you can be sure you are solving the right problem before you start working on it.

Pay attention to specific instructions. A problem statement may include detailed constraints and hints such as "use only bitwise operators" or "ignore the case when the string is empty" or "must run in constant time". You may want to highlight these instructions to be sure you don't overlook them. These constraints are not intended to make things difficult; typically we are trying to guide you in the direction of a straightforward and simple solution.

Save a little time for checking your work. Before submitting, reserve a few minutes to go back over your work. Check for matching parameter names passed into functions, etc. We try not to deduct points for minor things if it is obvious what you meant, but sometimes it is difficult to decipher your true intention. You might save yourself a few lost points by tidying up the details at the end.

The kind of systems coding we do in CS107 leaves much room for error, spanning the gamut from oversights such as forgetting to return the function result to more serious omissions such as failing to allocate memory for a pointer. Nearly everyone loses a few points that could have been avoided with more time and a chance to execute/test the code. However, a solid first-pass approximation that shows the correct conceptual understanding of the key issues will earn the bulk of the points and, in our analysis, deserves to be strongly distinguished from code that exhibits significant conceptual issues and would require much trial-and-error with compiler/debugger/Valgrind to turn into working code.

More broadly, the ability to analyze and reason about code in isolation is a valuable skill for any computer scientist. It forces you to think before you code, rather than leaning too much on the tools. At every step, you want to ensure that you understand the code you are writing, what it does, and how it works

After the exam

For most students, the assignment and exam performance are fairly well correlated but sometimes they do diverge a bit. It's pretty rare to rock the exam if your assignments didn't go well, but there are students who go into the exam with solid assignment scores and yet emerge with a disappointing outcome. What might explain this and what can you do about it?

Make sure you are mastering the material while completing the assignments. You should not complete assignments using trial or error techniques, make a change if you don't understand its implications, or only make modifications that the course staff tells you to. Even though you may get through the assignments, you won't be able to reproduce these results in an exam setting. The goal of an assignment is not to get the program to work, one way or another, it is about developing an understanding of how and why it works, and being able to take that understanding and write similar code in any environment, including one that doesn't have the luxury of a compiler/debugger/Valgrind/CA/sanitycheck to tell your whether the code is correct or not.

Gauge your comfort with the material. Did you feel like you spent a lot of time looking through your materials and clarifying concepts during the exam? Did you feel that the mistakes you made on the exam were just small oversights, or more conceptual? Use the exam results to answer these questions about your understanding of the material and use them to prepare even better for next time.

Ensure comfort in the testing environment. If you feel that one of the reasons behind how you did on the exam was lack of comfort in the testing environment (no tools, time limits, etc.), make sure to practice more in test-like conditions. Review your exam, introspect on what happened, brainstorm tactics for next time, and do some practice.

You can do it!