Written by Nick Troccoli, based on documents by Julie Zelenski, Marty Stepp and others
Friday, December 13th, 8:30AM-11:30AM
Monday, December 9th, 7-8:30PM in Hewlett 201
Final Exam Questions
Final Exam Blank Answers
Final Exam Solutions
Final Exam Grading Information
You can find code for testing your answers by making a personal copy of
Scores and Graded Exams
How do I find out my score? The scores have been released on Gradescope, a website for grading course materials. If you did not receive an invitation to join Gradescope (please check your spam folder!) please contact the course staff. Log in to Gradescope to see your score. You can also see your overall score in Gradebook.
If you have questions about exactly what points you missed and why, please look over the grade and markings made by the grader and compare it with our answer key and test project. If you still have any questions, send the course staff an email.
The statistics of the exam scores (rounded to the nearest whole number, out of 180) were as follows:
Mean: 136 Median: 144
We work hard to grade consistently and correctly, but sometimes we make mistakes in grading. If you believe part of your exam was incorrectly graded, please first copy the solution project in
afs/ir/class/cs107/samples/final and run your answer. This is the easiest way to test your code. If, after running your code, you still believe your grade is incorrect, submit a regrade request online via Gradescope (first view the question in your exam, and submit a regrade for that question on that page). Regrade requests need to point out the aspect of the problem that was misgraded. We use a detailed rubric to grade exams which is documented in the Final Exam Grading Information document linked above, so you must clearly articulate how the specified rubric was misapplied when grading your answer. You must also submit test program output for the given problem (if applicable), and a copy of your code (if needed, with any minor syntax errors corrected), and any other necessary code/content so that we can run and evaluate your code.
Regrade requests will be accepted starting on Thurs. 12/19 at 9AM PST. The testing code will be up shortly before then.
You must provide all the required information listed above and in the regrade request form in order for us to review your regrade request. Also, we reserve the right to re-grade the whole exam to make sure there are no other grading issues present - this may result in a lower total score.
All regrade requests must be submitted by the end of the first week of Winter quarter - by 11:59PM on Sunday, January 12, 2020.
If you need a laptop for the exam, you must let us know by Friday 12/6 @ 11:59PM PST. Limited charging outlets will be available during the exam.
The final exam will be held our registrar-scheduled exam time: Friday, December 13, 8:30AM-11:30AM. 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 exams are 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 closed-book. You may bring a double-sided US-Letter-sized (8.5"x11") page of your own prepared notes. The exam will include a reference sheet of essential details such as prototypes for standard library functions (e.g.,
malloc), as well as an additional reference sheet with the common x86-64 assembly instructions.
You will take your exam electronically, using our custom BlueBook exam software, which you can run on your computer if you have one. If you do not have access to a laptop for the exam that can run BlueBook, please contact the course staff as soon as possible. You cannot access notes, run other applications, use the Internet, nor use any other electronic devices during the exam.
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. >= lab5 and assign5).
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 Piazza 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.
Check your rear-view mirror for the very impressive list of things you've learned in 107!
- 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, floating point, 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 strategies and tradeoffs
- Performance: compiler optimizations, profiling
What To Bring
The exam is on your computer. You should bring:
- Your laptop and charger
- The device you use for two-step authentication (to submit the exam)
- your double-sided page of notes
- A power strip/extension cord (optional, but recommended if you have access to one)
The 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 (see below for permitted aids), and say something to the instructors or students in question to prevent any inappropriate activity conducted by others surrounding the exam.
Permitted Materials: During the exam, you may use/reference:
a double-sided US-Letter-sized (8.5"x11") page of your own prepared notes.
a provided reference page of essential details such as prototypes for standard library functions (e.g.,
malloc). This is included in the BlueBook exam.
a provided reference page of common x86-64 assembly instructions. This is included in the BlueBook exam.
You are not permitted to use any other materials, such as printouts (notes, slides, code, practice exams, etc.), other textbooks, or electronic devices (iPads, Kindles, calculators, music players, etc.).
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 extremely roundabout/awkward/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. 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
#includestatements on the exam. Please do not abbreviate any code on the exam (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 should include your answer, as well as any scratchwork, in the text 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.
BlueBook Software: The BlueBook program you will use for the final exam is the same as the one you downloaded for the midterm exam. Here are the links if you need to download it again:
IMPORTANT: Once you have downloaded the installer file, install BlueBook wherever you wish on your computer. If you're using a Mac and you get an error saying that the Disk Image is from an unidentified developer, open up the installer file in your finder, and right click it and select "Open." The same window will pop up, but this time you'll have a chance to open it anyway. If you get any popups asking for keystroke or other permissions, please make sure to grant them in order for the exam to administer properly. On Windows, if you get a message that says, "Windows protected your PC," you can click on "More info" and then "Run anyway."
Exam Reference Sheets: Note: the reference sheets are included as the last "problems" in the BlueBook exam. You will be provided with hard copies as well during the exam.
Note: the practice BlueBook exam below is configured with an infinite time limit. You cannot close BlueBook and come back to work on the exam later - you must complete it in one sitting. You cannot submit practice exams, and you will lose your work if you do - if you'd like to check your answers, leave BlueBook open while you do so. Note that for security reasons, BlueBook disables copy/pasting into or out of BlueBook. You can copy/paste within BlueBook, however.
Guide for how to approach and succeed on CS107 exams.
Review Session Materials: PDF
Video on Canvas (under "Course Videos" tab)
[The information below is the same as the information provided for the midterm exam, but included below for reference]
Based on a handout by Brahm Capoor
BlueBook is a program that can administer electronic exams distributed in a special file format. BlueBook itself does not come with any exams but is rather just an application used to take exams. Your exams, including practice exams, will be distributed as special BlueBook files uploaded to the course website. These exam files are encrypted and cannot be opened without a password, which will be provided to you at the start of the exam, or along with the practice materials. Download these files and keep them wherever you wish on your computer.
Once you have BlueBook installed and an exam downloaded, begin by opening BlueBook. On a Mac, if you get a message saying that you were blocked from opening the app for security reasons, browse to the app in the Finder, right click it and select "Open." The same window will pop up, but this time you'll have a chance to open it anyway. The app should go full screen and allow you to choose the exam file you downloaded earlier. Click the folder icon on the right of the screen and navigate to the exam file and click ‘ok’, followed by ‘Load Exam’. At this point, you’ll be brought to the Exam Start Screen. Fill out your details on this screen, fill in the password and click ‘Start Exam’.
You’ll then be brought to the main Exam View, which allows you to go back and forth between all the questions for the duration of the exam. You can navigate between questions using the toolbar at the top of the window. The text editor provided to you will have syntax highlighting, bracket completion and automatic indenting, but will not allow you to compile your code. The exam will end automatically after the specified duration ends.
We know that BlueBook is not the same as working with a compiler as you do on Myth, 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.
When you are done with your exam – or time has run out – you can begin the submission process for the exam. Do so by clicking the blue ‘Submit’ button in the toolbar. Once time runs out, this process automatically starts. Beginning submission is an irreversible decision, so make sure that you’re confident you’re ready to turn your answers in. Once you confirm that you want to submit, the BlueBook window will shrink and allow you to turn on your internet in order to submit the exam. Importantly, we verify your identity while submitting, so please make sure to have your two-step authentication device with you. Once your submission is successful, you will see a message with a green check mark and a confirmation code of your exam submission, which you should keep for your records in case any issues arise later. At this point, feel free to close BlueBook. Congratulations! You’re done with the exam!
Some final notes about BlueBook:
- Please make sure that your laptop has at least a few gigabytes of free space before the exam begins. While BlueBook exams certainly don’t take up that much space, we do back up your answers in case your computer crashes and we want to make sure your computer has enough space for these backups.
- Please come to the exam with a fully charged laptop. While there will be some facilities to charge your laptops during the exam, there will likely not be enough for everyone.
- BlueBook is capable of detecting if you switch away from the window during the examination. In order to avoid this signal being triggered accidentally, please disable your internet connection and/or notifications before the exam begins. You will have the opportunity to turn them back on when the time comes to submit.
- Should your laptop crash during the exam, please see a proctor as soon as possible so they can restore your answers and you can continue working. Do not attempt to restart the exam from scratch as this might overwrite your previous answers.