Computer Systems: A Programmer's Perspective, 3/E (CS:APP3e)

# Example Exam Problems

This page gives the Latex sources for some of the classic exam problems from the ICS+ class at Carnegie Mellon. You'll need a CS:APP instructor's account to access the individual problems. Here is how the page is organized:
• The problems are bundled together into a single master exam.
• For each problem, we give its problem number in the master exam, a brief description, and the point total, which corresponds roughly to expected solution time in minutes.
• The solution for each problem is embedded directly in the Latex source file. Search for the keyword "answer".
• Problems are sorted by topic area.

### Notes:

• Solutions to these problems are sure to leak out, so protect yourself by tweaking them a bit.
• At CMU, we publish previous exams with solutions on the course web page, so that students with access to fraternity files don't have an unfair advantage. These old exams are a good source of examples that you can then tweak.

### Individual Exam Problems

• Chapter 1: A Tour of Computer Systems
• Chapter 2: Representing and Manipulating Information
• Problem 1: Structure and union alignment (6 pts) [pdf, latex]
• Problem 2: Bit manipulation (matching problem) (12 pts) [pdf, latex]
• Problem 3: Floating point classification (8 pts) [pdf, latex]
• Problem 4: Floating point puzzles (interesting values) (12 pts) [pdf, latex]
• Problem 5: Floating point puzzles (interesting values) (12 pts) [pdf, latex]
• Problem 6: Floating point puzzles (8 bit) (12 pts) [pdf, latex]
• Problem 7: Integer and floating point puzzles (20 pts) [pdf, latex]
• Problem 8: Structure layout and access (9 pts) [pdf, latex]
• Problem 9: Two's complement encoding and arithmetic (9 pts) [pdf, latex]
• Problem 10: Floating point encoding (8 pts) [pdf, latex]
• Problem 11: Two's complement encoding (5 bit) (8 pts) [pdf, latex]
• Problem 12: Two's complement encoding (6 bit) (10 pts) [pdf, latex]
• Chapter 3: Machine-Level Representation of Programs
• Problem 13: Array layout and access (8 pts) [pdf, latex]
• Problem 14: Array layout and access (8 pts) [pdf, latex]
• Problem 15: Array layout and access (8 pts) [pdf, latex]
• Problem 16: Structure and array layout and access (6 pts) [pdf, latex]
• Problem 17: Decompiling a C ``for'' loop (8 pts) [pdf, latex]
• Problem 18: Array layout and access (14 pts) [pdf, latex]
• Problem 19: Structure and union layout and access (12 pts) [pdf, latex]
• Problem 20: Decompiling a C ``for'' loop (8 pts) [pdf, latex]
• Problem 21: Decompiling a C ``for'' loop (8 pts) [pdf, latex]
• Problem 22: Decompiling a C ``for'' loop (8 pts) [pdf, latex]
• Problem 23: Decompiling a C ``for'' loop (10 pts) [pdf, latex]
• Problem 24: Decompiling a C ``for'' loop (10 pts) [pdf, latex]
• Problem 25: Decompiling a C ``for'' loop (8 pts) [pdf, latex]
• Problem 26: Stack discipline (Dr. Evil's buffer overflow) (10 pts) [pdf, latex]
• Problem 27: Mapping of arithment operations to assembly (7 pts) [pdf, latex]
• Problem 28: Matching C conditional to the corresponding assembly (3 pts) [pdf, latex]
• Problem 29: Matching C two's comp arithmetic to the corresponding assembly (3 pts) [pdf, latex]
• Problem 30: Matching C pointer code to the corresponding assembly (3 pts) [pdf, latex]
• Problem 31: Stack discipline (buffer overflow) (8 pts) [pdf, latex]
• Problem 32: Stack discipline (buffer overflow) (12 pts) [pdf, latex]
• Problem 33: Stack discipline (function call and return) (4 pts) [pdf, latex]
• Problem 34: Stack discipline (6 pts) [pdf, latex]
• Problem 35: Stack discipline (buffer overflow) (Part I) (14 pts) [pdf, latex]
• Problem 36: Stack discipline (buffer overflow) (Part II) (8 pts) [pdf, latex]
• Problem 37: Structure alignment and access (10 pts) [pdf, latex]
• Problem 38: Structure layout and access (10 pts) [pdf, latex]
• Chapter 4: Processor Architecture
• Chapter 5: Optimizing Program Performance
• Problem 39: Program optimization (8 pts) [pdf, latex]
• Problem 40: Program optimization (9 pts) [pdf, latex]
• Problem 41: Associativity and its relationship to parallelism (cool!) (10 pts) [pdf, latex]
• Chapter 6: The Memory Hierarchy
• Problem 42: Low-level cache access (5 pts) [pdf, latex]
• Problem 43: Low-level cache access (5 pts) [pdf, latex]
• Problem 44: High-level cache miss rate analysis (8 pts) [pdf, latex]
• Problem 45: Basic cache organization (6 pts) [pdf, latex]
• Problem 46: High-level cache miss rate analysis (7 pts) [pdf, latex]
• Problem 47: High-level cache miss rate analysis (8 pts) [pdf, latex]
• Problem 48: High-level cache miss rate analysis (12 pts) [pdf, latex]
• Problem 49: High-level cache miss rate analysis (10 pts) [pdf, latex]
• Problem 50: High-level miss rate analysis (14 pts) [pdf, latex]
• Problem 51: Medium-level cache conflict miss analysis (4x4 transpose) (8 pts) [pdf, latex]
• Problem 52: Medium-level cache conflict miss analysis (2x2 transpose) (8 pts) [pdf, latex]
• Chapter 7: Linking
• Chapter 8: Exceptional Control Flow
• Problem 53: Process control (5 pts) [pdf, latex]
• Problem 54: Process control (4 pts) [pdf, latex]
• Problem 55: Process control (10 pts) [pdf, latex]
• Problem 56: Process control (5 pts) [pdf, latex]
• Problem 57: Process control (8 pts) [pdf, latex]
• Problem 58: Process control and signals (16 pts) [pdf, latex]
• Problem 59: Signals and signal handling (4 pts) [pdf, latex]
• Problem 60: Process control and signals (timeout version of fgets) (8 pts) [pdf, latex]
• Chapter 9: Virtual Memory
• Problem 61: VM address translation (10 pts) [pdf, latex]
• Problem 62: VM address translation (10 pts) [pdf, latex]
• Problem 63: VM address translation and cache lookup (12 pts) [pdf, latex]
• Problem 64: Dynamic memory allocation (8 pts) [pdf, latex]
• Problem 65: Dynamic memory allocation (10 pts) [pdf, latex]
• Chapter 10: System-Level I/O
• Chapter 11: Network Programming
• Chapter 12: Concurrent Programming

Questions or problems with your account? Forget your password? Send mail to Dave O'Hallaron