Table of Contents

1 Past exams

The following are the practice and real exams prepared for last year. While we have explained a few ideas slightly differently than this semester, these should be considered good baselines for what to expect in exams this year.

Sometimes exams contained typos, resulting in more lenient grading that the key would indicate. In some, but not all, cases those typos were corrected before being posted here.

Semester Exam Practice Actual Key Mean Median Deviation
Fall 2018 1 pdf pdf html 89.9% 93.8% 10.3%
Fall 2018 2 pdf pdf html 78.8% 79.5% 16.7%
Fall 2018 3 pdf pdf html 64.5% 69.8% 25.7%
Fall 2019 1 pdf html 83.2% 86.8% 12.4%
Fall 2019 2 pdf html 75.5% 78.7% 12.4%
Fall 2019 3 pdf 76.7% 80.0% 14.9%
Spring 2022 1 pdf pdf 89.9% 94.0% 13.6%
Spring 2022 2 pdf pdf 80.8% 84.0% 14.0%
Spring 2022 3 pdf pdf 74.8% 78.1% 15.2%

The final exam will be about half material from exams 1 and 2 and about half new material.

The final will include printed-out excerpts from manual pages. These might include pages for functions you have not previously used. It may also contain reference material on various assembly instructions, etc.

Some material from previous exams has timed out; for example, if we ask about our toy ISA on the final we’ll provide a reminder of its relevant details as we hope you’ve re-used the memory that used to remember where the icode goes in the encoding, etc.

You are expected to know, without consulting any source,

Assembly
  1. AT&T syntax, including all addressing modes ($1, %rax, and the various memory accesses like (%rax) through foo(%rax, %rbx, 8))

  2. The special use of %rsp as the stack pointer

  3. The calling convention use of %rax, %rdi, and %rsi – if others are needed, they will be provided on the exam

  4. The 4-, and 8-byte versions of each instruction (e.g., movl, and movq) and the first eight registers (e.g., %eax = %rax)

  5. x86-64 assembly instructions mov, add, xor, call, ret, lea, cmp, jmp, and the signed conditional jumps (jle and so on)

C
  1. The meaning of all operators, including | vs ||, . vs ->, ?:, etc.

    • but you do not need to know the difference between prefix- and postfix-notation for ++ and --
    • nor do you need to know the precedence of non-arithmetic operators
      • but if you don’t know precedence, you had better use parentheses!
  2. The correct signature for main (both with and without arguments)

  3. The behavior of library functions malloc, free, realloc, open, close

  4. The library function read, but just its common usage, not all the special cases

  5. The library functions puts, printf, fopen, fclose, and at least one reads-from-FILE * function

You are of course also expected to recall all the syntax and semantics details needed to read and write code in both AT&T x86-64 and C.