Final exam


For the final end-quarter assessment, we use a traditional format comprehensive exam to evaluate your achievement of the learning goals for the CS106B course.


  • The Testing Window is the 24-hour period starting Monday, December 6 12:01am PT and ending Monday December 6 11:59pm PT.
    • All students must complete the exam within the Testing Window without exception.
  • We design the exam for a completion time of roughly 2 hours, but you may work up to 3 hours if you so choose.
    • Students registered with OAE receive extended time pursuant to their accommodations. Students for whom this information is relevant will receive an email from us with more details.
  • You may choose to take the exam in any 3-hour block that is entirely contained within the Testing Window.
    • You do not have to communicate your planned schedule to us.
    • Gradescope will automatically monitor the time you start and when you submit.
    • Your submission must be received no later than 3 hours after your start.
    • Late submissions will not be accepted.
  • The exam will be completed online using the Gradescope website.
    • We have posted the sample version of the exam on Gradescope .
    • Use this sample as a "dry run" to become familiar with the delivery format and confirm you can successfully follow the process end to end.
    • You will need a stable and reliable internet connection for the duration of the period you plan to take the exam.
    • If you run into any snags with using Gradescope, please reach out to us for help. Please do this as soon as possible, preferably well in advance of the opening of the Testing Window, so there is sufficient time to resolve any issues.
  • The exam is open-book/note and closed-human.
    • Open-book/note means it is permitted to consult inanimate resources.
    • Closed-human means it is not permitted to communicate with any other humans (other than private communication to course staff to request clarification).
  • All students are bound to uphold their obligations to the Stanford Honor Code.

Honor Code

The Honor Code as it applies to assessments in this course:

  • You must not give nor receive unpermitted aid of any form.
  • All of the answers you submit must be your independent, original work; not jointly developed nor derived from the work of another.
  • You are not permitted to discuss, share, or solicit any information whatsoever about the exam in any public or private communication channel.
    • The prohibition applies during the entirety of the Testing Window.
    • The prohibition applies to communication in any form (no verbal description, no problem text, no diagrams, no code, and so on) and in any communication channel (no verbal/text conversation, no group chat, no email, no Ed post, no internet question/answer forum, etc.)

Here is a non-exhaustive list of what is permitted and what is not:


  • You may access the textbook and other books in printed or digital form
  • You may look at any materials on the course website (lecture slides, section problems, practice materials, etc.), read previous posts on the course Ed forum, and review your own assignment code on Paperless
  • You may look at reference materials available on the web (C++ language, documentation for standard and Stanford libraries, etc.)
  • You may use Qt Creator or Ed to run code samples
  • You may make a private post on Ed to ask the staff a clarifying question about the exam content

Not Permitted
Some example behaviors that would constitute a violation of the Honor Code

  • exchanging or collaborating on answers with others (unpermitted aid)
  • copying solutions you did not write yourself, such as answers from other students or answers found online, and submitting as your own work (plagiarism)
  • soliciting or sharing information about the exam at any point during the Testing Window (unpermitted communication)
  • any attempt to gain unfair advantage or circumvent security protocols, e.g. manipulating/hacking the Gradescope site (Fundamental Standard violation)

Coverage, sample/practice materials

  • Coverage. The coverage is comprehensive over the entire quarter, but expect heavier concentration on content from latter half of course. Topics that figured most prominently in lecture/section/homework will be assessed at greatest intensity/weight, and more minor excursions will have correspondingly lighter attention. Here is a list of topics of high importance:
    • client use of ADTs: design a data structure, demonstrate appropriate choice of ADTs, use of ADT operations to solve a problem, operational behavior of Vector, Grid, Stack, Queue, Set, Map, PriorityQueue, HashSet, HashMap, Lexicon
    • algorithm analysis / Big-O: analyze a piece of code and answer questions about its runtime complexity, write code that solves a problem within a given Big-O limit, demonstrate knowledge of the Big-O runtime for standard algorithms and ADT operations
    • recursion, recursive backtracking: use recursion or backtracking to solve a problem
    • searching and sorting: demonstrate knowledge of algorithms for linear search, binary search, selection sort, insertion sort, mergesort and quicksort
    • implementing ADTs/classes: implementation choices for standard ADTS (e.g. set/map as BST or hash table; stack/queue as linked list or dynamic array, vector as dynamic array, priority queue as sorted array or min heap); write ADT using alternative implementation, extend ADT with additional operations, discuss implementation tradeoffs in terms of design, Big-O efficiency, code complexity
    • heaps: trace operations to insert/remove elements into binary min-heap or max-heap, write code to implement binary heap operations
    • pointers: read/write code that uses pointers, most likely in context of dynamic arrays, linked lists, or trees, show understanding of correct use of dynamic memory including allocation/deallocation
    • linked lists: trace operations on a linked list, write code to create/traverse/modify linked lists, either singly or doubly-linked
    • binary trees: trace operations on a binary search tree (BST), write code to traverse/manipulate trees
    • encoding trees: trace operations on encoding tree, huffman algorithm, write code to operate on encoding tree
    • graphs: understanding of graphs data structure and implementation options (adjacency matrix vs adjacency list), trace simple graph algorithms (breadth-first and depth-first search)
    • hashing: simulate operations on a hash table that resolves collisions by chaining, show understanding of simple hash function
  • Format. Questions including on the final exam generally fall into one of the types below. The sample shows examples of various problem formats.
    • code writing: write code to implement a function, class, or program that solves a specified task
    • code reading: review a given code passage and reason about its behavior, analyze big-O runtime, or show output
    • trace/diagram: trace the operation of an algorithm or diagram a data structure
    • short answer: short prose answers to conceptual questions
  • Sample. To give a representative sample, we have taken an actual CS106B final exam from recent quarter and reworked into online format. This will allow you to practice using the same environment. You can find the sample on Gradescope and here on website sample with solutions.
    • We strongly recommend that you practice on the sample as if it were the real thing (set aside a block of time, gather the resources you plan to have on hand, and do a trial run using Gradescope).
    • After completing the sample, compare your answers to the solutions.
  • Further practice exercises
    • 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.
    • The online coding practice site Code Step By Step has been recommended by past students as a useful tool. It offers many practice problems and autogrades your answers to give immediate feedback.
    • Our fabulous Head TA Neel will lead a review session on Saturday afternoon. See this Ed post for more info.


Review the strategies and advice from the mid-quarter assessment.