Final Information


Final Policies

Date / Time: Wed, Dec 11 @ 2:30-4:20 (110 mins)
Location: Anderson 223

You will be provided with:
  • Reference Sheet: We will provide a copy of the Final Reference Sheet with your exam.
  • Printed Exam with Scratch Paper: Your exam will have extra blank paper for you to use if necessary. If you do use a blank page for a question, you must clearly make a note of that under the corresponding question. Otherwise, your work may not be graded.
  • Timekeeping (we will project a large clock at the front of the room)
You should bring:
  • Pencil/Pen
  • Eraser
  • Notes Sheets: You may bring up to TWO 8.5 x 11 inch sheets of paper, double-sided, with handwritten (not printed) notes.
You are NOT allowed to use/wear during the exam:
  • Hats or Sunglasses
  • Cellphones, Calculators, or any other electronic device

Final Topics

In general, the final will bias towards topics from the STL onwards (that is, >= lecture 14) and HW3/HW4, but anything we've done this quarter could appear; we suggest taking another look at the midterm topic list, below. Note that midterm topics are NOT the emphasis for the final exam, though of course some final topics include and build upon midterm topics; for example, it is difficult to write a question featuring smart pointers or inheritance without requiring an understanding of destructors.

Additional Topics for the Final

More C++

  • STL, containers, and iterators. You are not expected to know nitpicky details, but you should be able to use basic containers (vector, list, map) and iterators.
  • Smart pointers, reference counting semantics, and using with STL. Understand differences between unique_ptr (cannot be copied, but can move ownership to another), shared_ptr (reference counting), weak_ptr (using to break cycles and why this is needed)
  • Subclasses, inheritance, virtual functions, dynamic vs static dispatch (function calls), vtables, constructors and destructors in subclasses
  • Pure virtual functions and abstract classes (what they are, how it works)
  • Using class heirarchies with STL and smart pointers, assignment slicing, value vs pointer semantics

Network Programming

  • Basic network layers: physical, data link, IP, TCP, application
  • Packets, and packet encapsulation across layers
  • IP addresses, address families (IPv4 and IPv6), DNS, ports
  • Stream sockets, file descriptors, read, write, close
  • Client steps: address resolution, create socket, connect socket to server, read/write (including retries), close
  • Server steps: determine address and port, create socket, bind socket to address/port, listen (and how the OS queues pending connections), accept connection, read/write, close
  • Basic understanding of the factors contributing to network latency (eg, distance, material, topology)
  • Very basic HTTP and HTML (e.g., understand data sent and received by something like the HW4 web server)

Concurrency

  • Multiple processes and fork() (review of CSE351 mostly), shared file descriptors and close() in forked processes
  • Threads: concurrent execution inside a single process; know a few of the pthread basics (i.e., what it means to create a thread and start execution in a function; passing arguments to threads); basic issues involving sharing data between threads and locking.
  • Use of concurrency to improve throughput and resource utilization
  • Understanding the relative latency of various common system operations (ie, read from memory, disk, and network)

Final Practice

The following 3 finals are good examples to practice on. Should you need more practice, you can refer to this list. Remember that summer midterms are written for a shorter test period (60 mins) than our own (110 mins).

Autumn 2019 Exam   |   Sample Solution   |   Tang (110 mins)
Summer 2019 Exam   |   Sample Solution   |   Johnston (60 mins)
Spring 2019 Exam   |   Sample Solution   |   Hsia (1100 mins)
Winter 2019 Exam   |   Sample Solution   |   Perkins (110 mins)

The following pdf contains questions from old finals, but not from any of three final listed above. These questions were picked by TAs to help you prepare for the midterm.

Final Review Packet   |   Sample Solution

Midterm Information


Midterm Policies

Date / Time: Fri, Nov 1 @ 11:30-12:20 (50 mins; normal lecture slot)
Location: Anderson 223

You will be provided with:
  • Reference Sheet: We will provide a copy of the Midterm Reference Sheet with your exam.
  • Printed Exam with Scratch Paper: Your exam will have extra blank paper for you to use if necessary. If you do use a blank page for a question, you must clearly make a note of that under the corresponding question. Otherwise, your work may not be graded.
  • Timekeeping (we will project a large clock at the front of the room)
You should bring:
  • Pencil/Pen
  • Eraser
  • Notes Sheet: You may bring up to ONE 8.5 x 11 inch sheet of paper, double-sided, with handwritten (not printed) notes.
You are NOT allowed to use/wear during the exam:
  • Hats or Sunglasses
  • Cellphones, Calculators, or any other electronic device

Midterm Topics

In general, topics include materials from (1) lectures/sections/exercises up to -- but NOT including -- the STL and (2) homeworks up through HW2 are fair game on the midterm.

Program Organization

  • System layers: C language, libraries, and operating system
  • Building an executable: preprocessing, compiling, linking
    • Preprocessor: #include, #define, #ifndef, etc.
  • Structure of C/C++ programs: header files, source files
    • Declarations vs definitions
    • Organization and use of header files, including #ifndef guards
    • Modules in C – headers, implementations
    • Internal vs. external linkage; use of static for internal linkage
    • (Re)compilation and dependencies

C Language

  • Data types
    • Casting
    • Pointers (pointer arithmetic, relationship to arrays)
    • String constants, arrays of characters, C string library
    • Structs
    • Extended integer types (e.g. int32_t, uint64_t) and when to use them
    • typedef
  • C Standard I/O library
    • stdin, stdout, fopen, fread, scanf, printf, etc.
  • POSIX libraries: wrappers for systems calls
    • POSIX-layer I/O: open, read, write, etc.
    • Relationship between C standard library, POSIX library functions, and system calls
  • Process address space and memory map (code, static data, heap, stack)
    • Semantics/usage of memory segments (.text + .rodata, .data + .bss)
    • Object lifetimes: static, automatic, dynamic
    • Dynamic allocation (malloc, free)
  • Function parameters
    • Call by value semantics (including structs and pointers)
    • Arrays as parameters
    • Using pointers for call-by-reference semantics
    • Function pointers as parameters
  • Linked data structures (e.g. linked lists, hash tables)
  • Potential bugs (e.g. memory leaks, dangling pointers)

C++ Language

  • Classes and modularity, namespaces
    • Create and change simple class definitions
    • Constructors, copy constructors, assignments, destructors
  • C++ as contrasted with C
    • Type-safe stream I/O (cout, cin, << and >>)
    • Type-safe memory management (new, delete, delete[])
  • C++ features
    • References – particularly reference parameters
    • Use of const (const data and parameters, const member functions)
    • Templates - template parameters for classes and functions, what happens when the compiler generates an instance of a template

Midterm Practice

The following 3 midterms are good examples to practice on. Should you need more practice, you can refer to this list. Remember that some of these midterms are written for a longer test period than our own (which is 50 mins).

Autumn 2019 Exam (Version A)   |   Sample Solution (Version A)   |   Tang (50 mins)
Autumn 2019 Exam (Version B)   |   Sample Solution (Version B)   |   Tang (50 mins)
Summer 2019 Exam   |   Sample Solution   |   Johnston (60 mins)
Spring 2019 Exam   |   Sample Solution   |   Hsia (70 mins)
Winter 2019 Exam   |   Sample Solution   |   Perkins (50 mins)

The following pdf contains questions form old midterms, but not from any of three midterms listed above. These questions were picked by TAs to help you prepare for the midterm. Solutions will be posted after section.

Midterm Review Packet   |   Sample Solution