General Information and Syllabus

Based on a document by Julie Zelenski, Cynthia Lee, and others
Last updated September 22nd, 2026

Instructor: Jerry Cain (jerry@cs.stanford.edu)
Helper Hours on helper hours calendar
All course staff: See front page

Course Essentials

  • The class website for CS107 is located at https://cs107.stanford.edu. Please regularly check the course website as we will post lecture materials, handouts, assignments, and more.

  • We will have lecture on Mondays, Wednesdays and Fridays, 2:30 - 3:20PM in NVIDIA Auditorium.

  • We will be using Canvas to house lecture recordings, and little else. Access our Canvas course page right here

  • Visit helper hours if you have specific debugging or conceptual questions.

  • The myth servers are our remote workspaces for completing programming assignments. Read more in our getting started guide

Course Overview

CS107 is the third course in Stanford's introductory programming sequence. The CS106 courses provide you with a solid foundation in programming methodology and abstractions, and CS107 follows on this to build up and expand your breadth and depth of programming experience and techniques. The course will work from the C programming language down to the microprocessor to de-mystify the machine. With a complete understanding of how computer systems execute programs and manipulate data, you will become a more effective programmer, especially in dealing with issues of debugging, performance, memory, and robustness. Topics covered include: the C programming language, data representation, machine-level code, computer arithmetic, elements of code compilation, optimization of memory and runtime performance, and memory organization and management.

CS107ACE

CS107ACE, also called CS107A, Pathfinders (or ACE), is a supplementary instruction program that meets for a weekly section and holds Pathfinders-specific review sessions. CS107ACE is application-only; CS107ACE is done in addition to all the normal requirements for CS107. You will receive an extra unit of course credit for the work you do in this program. Enrollment in CS107ACE is by application, and you can find more information at this link: click here. Once enrollment decisions are made, students who are accepted will then be given a permission number to enroll in CS107ACE on Axess. If you have questions about CS107ACE, please email the ACE CA (contact information listed on the course homepage).

Prerequisites

The prerequisite for CS107 is CS106B (or equivalent). You should have practical C/C++ skills using recursion, dynamic data structures (pointers, linked lists, trees, graphs), data abstraction, classic data structures (lists, stacks, queues, sets, maps), and standard algorithms (searching, sorting, hashing). You should have an appreciation of the intrinsic value of good engineering and design and you will be expected to produce well-decomposed, readable code. Come talk with us if you need help determining the right course for you.

Units

If you are a matriculated Stanford graduate student, you may enroll in CS107 for 3-5 units based on your schedule. Otherwise, you are required to enroll in CS107 for 5 units. In particular, anyone enrolled as a Stanford undergraduate must register for the full 5 units, or you will not be assigned a grade in the course. Taking the course for reduced units does not alter the course requirements.

Course Accommodations

If you are ever suffering from a serious illness or dealing with a genuine emergency, you should reach out to the instructor and CAs to let us know how we can help. For obvious reasons, we need to be strict about deadlines, lab attendance, and exams, as we work very hard to ensure all students are treated fairly and trust that everyone is evaluated according to the same metrics.

We are, however, reasonable people, I promise you. If something exceptionally important comes up and it should obviously take priority over CS107, please let us know and we'll work something out.

Course Goals

The goals for CS107 are for students to gain mastery of

  • writing C programs with complex use of memory and pointers
  • an accurate model of the address space of C programs
  • the compile/runtime behavior of C programs

to achieve competence in

  • translating C to/from assembly
  • writing programs that respect the limitations of computer arithmetic
  • identifying bottlenecks and improving runtime performance
  • working effectively in a Unix development environment

and have exposure to

  • the basics of computer architecture
  • understanding compilers and disassemblers

Course Environment

We work very hard to create an environment that treats everyone with respect, regardless of previous experience.

  • Preparation: More so that in other disciplines, students come to computer science with different levels of prior experience. But as long as you meet the course prerequisites, you are prepared for success in CS107. If you don't believe me, just ask the CAs!

  • Classroom Environment: During lecture, we ask that any questions be clarifications for yourself or others of the course material being discussed, rather than a question or comment intended to demonstrate additional knowledge beyond the scope of the class.

  • Access and Accommodations: Stanford is committed to providing equal educational opportunities for disabled students. Disabled students are a valued and essential part of the Stanford community. We welcome you to our class. If you suffer from a disability, please register with the Office of Accessible Education (OAE), where those on staff will evaluate your needs and prepare an Academic Accommodation Letter that you can share with faculty. Once you obtain an accommodation letter, please email it to the course instructor as soon as possible so he or she can ensure your accommodation is respected and that your needs are being met.

  • Name and Pronouns: We want you to be you in our class. You should use your preferred name on all classwork and exams, and if you have a name and/or pronoun that doesn’t match our registrar-provided class roster, please let us know.

  • Course Expenses: If obtaining any material or resource for use in our class presents a financial hardship for you, please let us know and we will work with you minimize the hardship.

Course Structure

Course Grades

Final grades for the course will be determined using the following weights:

  • 20% Lecture Quizzes
  • 5% Lab Attendance
  • 20% Assignments
  • 20% Midterm Exam
  • 35% Final Exam

If you choose to take the course CR/NC, your final grade must be satisfactory or better--in other words, you need a C- or better to get a CR.

Lecture

Lectures are held in person on Mondays, Wednesdays, and Fridays. The best way to take advantage of all that lecture has to offer is to attend live in person. You can ask questions, participate in activities, and guide our focus in lecture based on your questions.

Beginning in Week 2, each Wednesday lecture will begin with a short quiz designed to exercise your understanding of the recently taught material and the most recent assignment to have falled due. The quizzes will, by default, be seven-minute, pencil and paper quizzes (closed note, closed book, closed electronic device, closed everything). All quizzes count equally, and the accumulation of all quiz scores count for 20% of your final grade.

Note that all quizzes begin promptly at the beginning of Wednesday lecture and end precisely seven minutes later. In particular, if you are late and you miss the quiz, you take a zero.

These quizzes are low-stakes opportunities to confirm your understanding of the material, and anyone who completed the most recent homework assignment and is up to date on lecture should find the quiz to be straightforward—so much so that I expect the median grade to be 90% or higher. However, because they are being administered as quizzes and contribute to your final grade, we must be firm that you attend Wednesday lecture and that you be on time.

We will not have quizzes during Week 1, midterm week, or during Week 10.

If you know of isolated weeks when you cannot be at Wednesday lecture, you can email the course instructor (well) ahead of time to arrange to take the quiz at either 8:30am or 9:30am that morning. All quizzes, like the midterm and final, must be taken in person, as they are bona fide exams that just happen to count very little toward your final grade.

We will, of course, grant students with accommodations the extra time they are entitled to. Please email the instructor with your OAE letter as soon as possible so we can arrange for you to take the quizzes in a separate room with others who have the same accommodation.

Labs

In addition to lecture, you must also sign up for a weekly, in-person lab led by one of our wonderful CAs. The labs are designed so that everyone leaves with a clear understanding of the material and the confidence to take on the next assignment.

Labs are 80 minutes, and attendance credit is granted when you arrive promptly, actively participate, and complete all of the exercises (or most of them should you run out of time). At the end of the lab, you will submit a checkoff sheet to record lab participation. If you are more than 10 minutes late, you will not get full attendance credit unless you were late because of a genuine emergency.

If you can't make your lab during any one week, you may attend another one provided you email the CA leading the alternate lab to confirm space is available.

Assignments

There will be seven assignments throughout the quarter, all of which are to be done individually. Unless otherwise noted, assignments are due at 11:59pm PT sharp on the specified dates and submitted electronically using the myth cluster. These machines are accessible remotely from other machines such as your personal computer, and they are pre-installed with all software used for labs and assignments. Students edit, compile, and debug on the myth systems using a suite of open source development tools including gcc, make, gdb, and valgrind.

Assignments may consist of written portions and coding portions, and are graded and returned to you electronically via the course website. The course staff grades each program on functionality (is the program’s behavior correct from an external perspective?) and style ("code review" - is the code clean, well-written and elegant?). Functionality is measured by how successfully the program executes on a comprehensive set of test cases. We create our test suite by working from the original program specification to identify a list of expected behaviors and write a test case for each. We use the autograder to run each submission through each test and award points for successful results. Your functionality score is a direct reflection of how much observably correct behavior your program exhibited. This process is completely automated, and the grader does not search your code to find bugs and deduct for them, nor do they appraise the code and award points for tasks that are attempted or close to correct. Occasionally, the TAs will manually award points for functionality thay can't be graded automatically.

The total number of points for an assignment is noted in its writeup. The points indicate the weight of that assignment relative to the others, i.e., an assignment graded out of 100 points has twice the weight of one graded out of 50.

Style is evaluated in ways that should be familiar to you from prior classes (building cleanly, cleanly running under Valgrind, etc.). The style guide outlines further guidelines. Your style score is mapped to the following scale. From past experience, most grades will be minor-issues.

  • great An outstanding job. Student code is notably exceptional: clean, elegant, and readable, with no issues whatsoever. Note that this is only given when the code to be written was substantial and your solution was particularly outstanding. As a result, these are rarely given. (This translates to a 100 come spreadsheet time.)
  • ok An solid job with no mistakes, but the code to be written couldn't really have been written any other way, so there's no room to be exceptional. (This translates to a 95.)
  • minor-issue Everything was great, except you had one minor style issue where you should have known better. (This translates to a 90.)
  • minor-issues Student code that meets most expectations, but also has opportunities for improvement. (This translates to an 85.)
  • major-issues Student code has so many minor errors and/or one or more major errors that the code would need to be revised and re-reviewed before being checked into a professional code base. (This translates to a 75.)
  • 0 So little code has been written that we can't really award you any points for style. (This translates to a 0.)

Using these categories means that the course staff can focus on the assignment’s learning goals rather than spending time justifying each point. Our goal is to maximize the learning experience in doing the assignments, and we have found the "bucket" grading system to work much better for style feedback than assigning numeric grades from a pedagogical perspective over many quarters of experience.

Disputes about homework grading must be submitted to the course staff within one week of grades being released. For more information about the assignment grading process, please see our page on how assignments are graded.

Assignment Late Policy

We understand everyone is busy, but falling behind on assignments just leads to more problems, and it interferes with our ability to code review submissions and return grades in a timely manner.

All programming assignments are due a minute before midnight, Stanford time. If you need to submit an assignment after the deadline, you still can. But doing so places a cap on the maximum number of points you can get, depending on how late you submit.

  • If you submit an assignment before the published deadline, then you can potentially get 100% of the points. Seems fair.
  • If you submit an assignment after the deadline, but within 24 hours, you can get at most 95% of the points. This doesn't mean we impose a 5% penalty regardless of your final score. It means that all scores between 9 6% and 100% are demoted to 95%, but all other scores are left alone. If your assignment is severely broken at the time you would normally need to submit, then you have a good reason to take an additional 24 hours to increase your score, as it can only go up. If your program is pretty much working with no obvious flaws, then you might submit it by the published deadline.
  • If you submit an assignment between 24 hours and 48 hours after the deadline, you can get at most 90% of the points.
  • If you submit an assignment between 48 hours and 72 hours after the deadline, you can get at most 85% of the points.
  • Unless you've made prior arrangements with the course instructor, we never accept work more than three days late.

Assignment Resubmission Policy

For all assignments except assign6, we will allow anyone who pulled less than 85% of the functionality points to re-submit their work to get to up to that 85% mark. (You must, however, have received at least 25% of the functionality points in the first place, otherwise the maximum you can get is three times your original score. This is to guard against student who ignore an assignment altogether and then submit the entire thing at some later date.)

We won't do code reviews on resubmissions, since the style component of an assignment grade is rarely more than 15% or so, and isolated minuses and double minuses have so little impact on your final grade that I don't want people to stress over them. Restated, we only rerun automated tests to see if you were able to fix any bugs that prevented you from doing well on the assignment. If you'd like to re-submit an assignment to hoist your functionality score up to 85%, email me when you're ready to submit again and I'll provide instructions on how to do so. I allow resubmissions up to one week after assignment grade reports are posted.

In theory, I'll let you re-submit as many times as necessary, though in practice you'll want to re-submit just once, maybe twice, to get to your 85%.

Examinations

The midterm examination is in-person and will be administered outside of class from 7:00-9:00PM PDT on Thursday, October 29th. If you have an academic or University conflict with this time, and absolutely cannot make the regularly scheduled midterm, then you can take the exam earlier that same day, from 3:30-5:30PM PDT. If you can't make either of these times, you should send a request by email to the course instructor by Friday, October 23rd to arrange an alternate exam time. Please include all the possible times you are able to take the exam on Thursday, October 29th.

The final examination is in-person and scheduled for Tuesday, December 8th from 8:30-11:30AM PDT. Those holding a documented conflict with the primary time can take the final the same day, but from 12:15-3:15PM PDT instead. Please make sure that you can take the final exam at one of these two times before enrolling in the class.

All examinations are administered on paper and are closed-book, closed-notes, and closed-computer, just like the quizzes. For the midterm and the final, a reference sheet will be provided along with some scratch paper. No other materials may be used.

The Honor Code

Academic conduct for students at Stanford is governed by the Honor Code. Part of the Honor Code is a pledge and expectation to participate in class without seeking inappropriate help on graded work such as assignments and exams. Please read the separate Honor Code page; you are responsible for knowing all of the details at this link, and for following the Honor Code in this course. Violations of the Honor Code are taken very seriously; we reserve the right to use software tools to compare your submissions against those of all other current and past students, and will refer all suspected violations to the Office of Community Standards (OCS).

Artificial Intelligence (AI) tools: While artificial intelligence (AI) tools can be valuable in certain contexts, in this course it is important that students develop their own skills and abilities to write, debug and think critically, without the use of this technology. For the assignments in this course, it will be the effort and process (not just the product) that is most valuable to your learning, and while useful, AI tools can inhibit the gains from working through this process. For that reason, you should only use AI tools in the same way that you would ask a friend in the class for help – high level questions, citations where needed, etc. Please see our Honor Code page for more information.

Course Resources

Technology

You will need to have access to a computer such as a Windows, Mac or Linux computer with an internet connection to complete assignments. If you don't have access to such a device, you can check out computers at the Lathrop Learning Hub or use on-campus library cluster computers. Read more about getting set up for assignment in our getting started guide.

Textbook(s)

Required: Bryant & O’Hallaron. Computer Systems: A Programmer’s Perspective. 3rd Edition.

The bookstore has a less-expensive custom version of this textbook for our course that includes only the chapters we will cover. You can also use the regular full 3rd edition. The assigned readings are generally optional, but many students feel the reading is helpful and worth the time.

Strongly recommended: We also strongly recommend you have a "C language goto" in whatever form works best for you: textbook, tutorial, reference sheet, website, etc. As one suggestion, The C Programming Language by Kernighan and Ritchie is the classic text and a digital copy is available for checkout via Open Library (make a free account to "borrow" it digitally). Another option is Nick Parlante's Essential C reader PDF available here.

There is also a CS107 reader: https://web.stanford.edu/~cgregg/cgi-bin/107-reader, which covers all of the course topics in detail.

Getting Help

We want to enable everyone to succeed in this course and offer several help resources. Read more about getting help in CS107.

  • Discussion Forum: The online discussion forum lets you search, ask and answer questions posted by fellow classmates. The course staff will also monitor and periodically respond to posts. The discussion forum is best for course policy questions, general course topic questions, general assignment questions or small debugging questions. It should not be used for larger questions about your assignment code.

  • Office Hours: Office hours are offered throughout the week, and are where you can sign up in a queue and get help from the course staff. Office hours are best for course topic questions, general assignment questions, or in depth questions about your code.

  • Instructor Email / Office Hours: For private matters such as grade questions or other sensitive or confidential topics, please feel free to reach out to the instructor directly or to visit his office hours to talk privately.

Other Information

Retraction Policy

You may contact the instructor at any time prior to the start of the final exam to retract all or part of previously-submitted assignment work, no questions asked. We will record a 0 as the grade for the work in question and act as though it was not submitted.

Affordability of Course Materials

All students should retain receipts for books and other course-related expenses, as these may be qualified educational expenses for tax purposes. If you are an undergraduate receiving financial aid, you may be eligible for additional financial aid for required books and course materials if these expenses exceed the aid amount in your award letter. For more information, review your award letter or visit the Student Budget website.

Lecture Video Notice

Video cameras located in the back of the room will capture the instructor presentations in this course. For your convenience, you can access these recordings by logging into the course Canvas site. These recordings might be reused in other Stanford courses, viewed by other Stanford students, faculty, or staff, or used for other education and research purposes. Note that while the cameras are positioned with the intention of recording only the instructor, occasionally a part of your image or voice might be incidentally captured. If you have questions, please contact a member of the teaching team.