Midterm 2 Information

Overview

Midterm 2 will strongly emphasize skills introduced after the cutoff date for Midterm 1 (so starting with recursion). That said, we can’t actually test the new topics without heavily involving Midterm 1 topics like C++ basics, ADTs and Big-O. So you should make sure that you first shore up any parts of your Midterm 1 foundation that are shaky, and then focus on the new topics.

Logistics

  • Midterm 2 is Wednesday November 11, 7:00 - 8:30pm PT.
  • Like last time, we will be spread across several rooms, and you will be assigned a specific seat in a specific room, so keep an eye out for notification about your seating location. Most of you will be in the same assigned room/seat, but you should still check the email notifications to verify.
  • Students with special circumstances (e.g., CGOE, OAE, varsity athletic conflicts) should have received an email from Head TA Tommy confirming you will receive special arrangements by end of Week 3. If you have not received an email from him by that time, reach out ASAP.
  • This exam is on paper, using pen/pencil. You will write your answers directly on the paper exam.
  • The exam is closed-book and closed-device.
    • We will provide the same reference sheet as Midterm 1, to jog your memory about the Stanford library functions.
    • You may bring one page 8.5"x11" of your own notes. We won’t require you to make it handwritten this quarter, but will trust you that your font size is something reasonable (no microfiche (!)).
    • You are not permitted to bring scratch paper or any paper other than the one sheet of notes. The exam will have designated space for scratch work.
    • Bring your Stanford photo ID. Leave backpacks, phones, Airpods/Bluetooh headphones, smart watches, etc, at home.

Coverage

  • Recursion (all types including inclusion/exclusion pattern, generating sequences, backtracking), dynamic memory (new/delete)
  • Pointers
  • Classes (.h and .cpp, member variables and functions, constructors and destructors, our StackInt and PriorityQueue implementations)
  • Binary heaps (priority queue)
  • Ethics of prioritization
  • Big-O (especially of new algorithms like binary search, heap enqueue)
  • Generally anything through Lecture 18 and Assignment 5 (first not-covered topic: linked lists)

Practice exams

Here are several practice exams. Note that in previous quarters, there was one midterm, held between our M1 and M2, and so some of the topics on our M2 were assessed on the Midterm and some on the Final Exam. For realism, we want to provide you the actual previous midterm and final exams as practice, but they will have this coverage mismatch issue. We’ve noted where it comes up, so you can skip those problems that we haven’t covered yet. We strongly recommend that you print out at least one practice exam and take it on paper under time pressure with only your reference sheet. That way you have a realistic calibration about what to expect on actual “game day.”

  • Practice Exam 1 (Solutions). This one has been curated to match this quarter’s Midterm 2, based on real questions from the Midterm and Final of the Winter 2026 class that I taught. Note that one of the questions on this exam references a problem thoes students had seen on their Midterm that quarter (about seating for a BTS concert). You should have seen that same problem in a practice exam for Midterm 1 (Question 2). If you didn’t do that one, you probably want to go do that one as preparation for this one, so you would be in the same shoes as a student in that quarter.
  • Go back to the Midterm 1 practice exams and do the problems about recursion that you skipped last time! These include both coding and certain Big-O sub-problems.
  • Study our own current quarter Midterm 1 (Solutions).
  • The following are old Final exams, so only do the the problems I’ve listed. Also note that I’ve sorted them in decreasing order of how relevant I think the practice is, so start at the top and you would be fine skipping the last couple.

Additional practice exercises:

  • Carefully study the in-class PollEv questions (you may have noticed that Midterm 1 borrowed from these, such as how the code in Question 4 borrowed straight from Lecture 6’s code example of counting words in books and putting them in a Map, and there were PollEv questions about key tricky issues associated with that).
  • Revisit our section materials. We pack each weekly section handout with many more exercises that fit in the section meeting, so there are plenty of good options there. Section exercises are similar size and scope to those we use for exams (in fact, many section exercises originally appeared on exams in previous quarters).
  • The exercises in the textbook are another great source for practice.

Advice

We absolutely want you to come out on top! The lectures, sections, and assignments work together to guide you toward mastery of the course learning goals and the exams serve as an assessment of your progress. The absolute best outcome everyone has a great grasp on the material to nail the exam.

Read on for our advice on how to make that happen for you!

Miscellaneous Resources

Final Thoughts

✨We want you to do well on this exam.✨

See this as an opportunity to show what you’ve learned and display your great efforts in the class so far. Always remember why you are here! Your efforts to build practice skills and real understanding will take you a lot further than a pristine transcript. If you work hard toward mastery and feel good about your understanding of computer science that is an achievement to be proud of—regardless of how many points you get relative to the other students in the course.