Final Exam Information

Written by Nick Troccoli, Jerry Cain and Lisa Yan, based on documents by Julie Zelenski, Sean Szumlanski and others

Date/Time:

Wednesday, June 10, 8:30AM-11:30AM PDT

Location: CEMEX Auditorium

Review Session: TBD (slides and video available afterwards)


If you have academic accommodations, e.g. through OAE or athletics, please let us know by Friday 4/17 @11:59PM PST (or, if you have accommodations starting after this date, please notify us as soon as possible). For OAE accommodations, please upload your OAE letter using our OAE form here.

Overview

The final exam is a 3-hour, closed-book, closed-note, closed-computer pencil-and-paper exam that will be held during our registrar-scheduled exam time: Wednesday, June 10, 8:30AM-11:30AM PDT. For the final 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 final exam at the specified time before enrolling in the class.

The exam is 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 strictly individual work.

During the exam, you may use/reference:

  • a provided reference sheet of essential details such as prototypes for standard library functions (e.g., strcpy, strlen, malloc), commonly used constants, as well as an additional reference sheet with the common x86-64 assembly instructions. This will be provided along with the exam, and you can find links to the reference sheets further down on this page.
  • scratch space; this will be built into the exam. You are not permitted to use your own scratch paper.

You are not permitted to use any other materials, such as printouts (notes, slides, code, practice exams, etc.), other textbooks, or electronic devices (computers, iPads, Kindles, calculators, music players, etc.), even to check the time. We'll make sure there's a readable clock in the classroom.

The exam may be a mix of short answer, multiple choice, code reading, code writing, etc. questions. The exam may not mimic the structure of any past exams, but the exam will consist of questions that fairly exercise your understanding of the material covered in the course.

Course staff will be proctors in the exam room to facilitate the exam and to answer clarification questions.

This course is participating in the proctoring pilot overseen by the Academic Integrity Working Group (AIWG). The purpose of this pilot is to determine the efficacy of proctoring and develop effective practices for proctoring in-person exams at Stanford. To find more details on the pilot or the working group, please visit the AIWG’s webpage. The AIWG Student Information Guide is available to review here: click here.

We are using a seating chart during the exam; click below to view your assigned seat (link live one week prior to exam date). This also includes information about dates/times for OAE / alternate exams:

Open Seating Webpage

There are practice exams from prior quarters below.

We know that a written exam is not the same as working with a compiler as you do on the myth machines, 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.

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


Logistics

(Same as midterm exam)

Early Exit Policy

To minimize noise during the last portion of the exam, we are requiring that all students remain seated if present for the last 15 minutes of the exam. In other words, you may leave early if you finish prior to the "15 minutes left" mark, but once the "15 minutes left mark" hits, we will ask students to remain seated to minimize any noise for the remainder of the exam (restroom breaks are permitted, but we won't be able to allow students to leave early at that point).

Proctoring, Seating Assignments, IDs and Bag Policy

In order to ensure the integrity of the testing environment as much as possible, the exam will be proctored, and the following policies and procedures will be in place: an assigned seating system, checking Stanford Student IDs at the exam, and requiring that any bags be placed at the front of the room during the exam.

  • Assigned Seating: Beginning 1 week prior to the exam date, you may visit this link to view your seating assignment. This includes students with exam accommodations who are taking the exam in a separate location - this page will show your exam location and seat (if applicable - assigned seats are only used for the main exam room). We recommend stopping by your assigned room to locate your seat at least one day before the exam, and arriving to the exam room early on the day of the exam to give yourself plenty of time to find your seat. You'll be required to take the exam in your assigned room and seat. We also recommend taking a screenshot 📷 of your seating assignment just in case of last-minute technical hiccups accessing the site.
    • Do you need a left-handed desk in the main exam room to take the exam, or are you a remote/CGOE student who wants to take the exam in person? If so, please fill out the form linked at the top of this page.
  • Checking IDs: we will be checking IDs at the exam; please bring your Stanford Student ID with you to the exam.
  • Bag Policy: During the exam, all bags must be placed at the front of the room. We recommend bringing only what you need to take the exam with you to the exam room - e.g. writing implement(s), water, Stanford ID, etc. If you bring any electronic devices with you, we require that they be placed in a bag at the front of the room for the duration of the exam. This includes devices such as cell phones, smartwatches, calculators, etc.

If you need to use the restroom during the exam, you must check in with a proctor before leaving the classroom - they will record the sign-in and sign-out times on your exam cover page.


Material Covered

The final is intended to assess your understanding of the content covered throughout the course. The priority is on material that figured prominently in the assignments, labs, lecture, and reading (this list is in order of decreasing emphasis). The topic coverage for the final exam will be comprehensive and span the entire quarter, but expect more emphasis on material covered after the midterm (i.e. >= lab4 and assign4, since assign4 was only lightly covered on the midterm). The ethics material is included in the material covered on the exam.

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 B&O textbook also contains many exercises if you want additional problems to work.

We'd love to see the discussion 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.

Topics Summary

Check your rear-view mirror for the very impressive list of things you've learned in 107! Here's a list of main topics (not fully exhaustive):

  • All about C and memory: C—strings, arrays, pointers, void*, pointer arithmetic, typecasts, function pointers, generics, stack and heap
  • Data representation: bits, bytes, ASCII, two's complement integers, pointers, aggregate types (arrays and structs)
  • x86-64 assembly: data access and addressing modes, arithmetic and logical ops, implementation of C control structures, call/return
  • Address space: layout and purpose of text/data/stack/heap segments, handling of different variable scopes/types
  • Runtime stack: caller/callee protocol, parameter passing, use of registers
  • Memory and heap: stack versus heap allocation, heap allocator implementations, strategies and tradeoffs
  • Performance and optimization: compiler optimizations, profiling
  • Ethics: vulnerabilities and disclosure, partiality, privacy and trust

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

(Same as midterm exam)

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.

  • You are not required to write #include statements. Please do not abbreviate any code (such as writing "x2" next to code to copy it twice). Abbreviated code will not be graded.
  • For questions expecting code, 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 answer 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.
  • 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!

There are practice exams from prior quarters below.


Downloads

Exam Reference Sheets: Note: the reference sheets will be included with the exam.

C Reference Sheet Webpage | C Reference Sheet PDF
(This is the same reference sheet as on the midterm exam)

Assembly Reference Sheet
(This is the same assembly reference sheet we have used in class and labs)

Practice Materials:

Guide for how to approach and succeed on CS107 exams.

Compilation of frequently-asked questions for the practice final exams: click here.

Note: some of the exams include questions covering floats, which is not included this quarter on our final exam topics.

Practice Exam 1: PDF | Solutions
This is based on the final exam from CS107 Winter 2018.

Practice Exam 2: PDF | Solutions
This is based on the final exam from CS107 Fall 2017. It was written as a 180 minute paper exam (same length as this quarter).

Practice Exam 3: PDF | Solutions
This is based on the final exam from CS107 Fall 2018. It was written as a 180 minute paper exam (same length as this quarter).

Practice Exam 4: PDF | Solutions
This was the final exam from CS107 Fall 2022.

Practice Exam 5: PDF | Solutions
This was the final exam from CS107 Fall 2023.

Extra Practice Problems: PDF | Solutions

Ethics Material Practice Problems: PDF | Solutions

You can do it!