Exams



Midterm Details


Midterm Policies

You will have 70 minutes to complete the exam. We will distribute the exam early and you can read and fill out the cover page of the exam, but you should not look at the exam questions until you are told to begin.

  • To Bring: pencil, eraser, ONE double-sided sheet of handwritten notes
  • Provided: printed exam with white space for work, midterm reference sheet, time keeping
  • Not Allowed: watch, hat, calculator, cell phone, or any other electronic device

Midterm Topics

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
    • Faking modularity in C – headers, implementations
    • Internal vs. external linkage; use of static for internal linkage
    • Dependencies and recompilation
    • Make and makefile basics
  • Version control basics (git)
    • add, commit, push, etc.
    • What to put in a repo and what to leave out

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)
    • typedef
  • Standard I/O library and streams
    • 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
  • Error handling - error codes and errno
  • Process address space and memory map (code, static data, heap, stack)
    • Object lifetimes: static, automatic, dynamic
    • Dynamic allocation (malloc, free)
  • Function parameters
    • Call by value semantics (including structs, pointers)
    • Arrays as parameters - pointers
    • 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
  • Other basic differences from C
    • Simpler, type-safe stream I/O (cout, cin, << and >>)
    • Type-safe memory management (new, delete, delete[])
    • References – particularly reference parameters
    • More pervasive use of const (const data and parameters, const member functions)

Midterm Practice

The following review packet will be used in section.

Below are links to some past midterms.

In addition to old exams, you will want to review homework exercises, work the suggested exercises at the end of most of the lectures, and review lecture and section material.


Winter 2020
Exam   |   Sample Solution   |   Hsia
Autumn 2019
Exam   |   Sample Solution   |   Tang
Summer 2019
Exam   |   Sample Solution   |   Johnston
Spring 2019
Exam   |   Sample Solution   |   Hsia
Winter 2019
Exam   |   Sample Solution   |   Perkins
Autumn 2018
Exam   |   Sample Solution   |   Perkins
Summer 2018
Exam   |   Sample Solution   |   Perkins
Spring 2018
Exam   |   Sample Solution   |   Hsia
Autumn 2017
Exam   |   Sample Solution   |   Perkins
Summer 2017
Exam   |   Sample Solution   |   Perkins
Spring 2017
Exam   |   Sample Solution   |   Perkins
Summer 2016
Exam   |   Sample Solution   |   Perkins
Spring 2016
Exam   |   Sample Solution   |   Perkins
Winter 2016
Exam   |   Sample Solution   |   Perkins
Summer 2015
Exam   |   Sample Solution   |   Perkins
Spring 2015
Exam   |   Sample Solution   |   Perkins
Summer 2014
Exam   |   Sample Solution   |   Perkins
Spring 2014
Exam   |   Sample Solution   |   Perkins
Winter 2014
Exam   |   Sample Solution   |   Perkins
Summer 2013
Exam   |   Sample Solution   |   Perkins
Spring 2013
Exam   |   Sample Solution   |   Perkins
Summer 2012
Exam   |   Sample Solution   |   Perkins
Spring 2012
Exam   |   Sample Solution   |   Perkins
Spring 2011
Exam   |   Sample Solution   |   Perkins

Final Exams


Final Policies

You will have 110 minutes to complete the exam. We will distribute the exam early and you can read and fill out the cover page of the exam, but you should not look at the exam questions until you are told to begin.

  • To Bring: pencil, eraser, ONE double-sided sheet of handwritten notes
  • Provided: printed exam with white space for work, final reference sheet, time keeping
  • Not Allowed: watch, hat, calculator, cell phone, or any other electronic device

Final Additional Topics

More C++

  • Templates - template parameters for classes and functions, what happens when the compiler generates an instance of a template
  • STL, containers, and iterators. You are not expected to know picky details, but you should be able to use basic containers (vector, list, map) and iterators.
  • Smart pointers, reference counting semantics, 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
  • C++ casts

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 retrys), 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
  • 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

Final Practice

The following Final Review packet will be used in the Final Review session.

  • Final Review Packet (solutions)

Past finals:

Note: Summer final exams are 60 minutes long compared to 110 minutes during the regular year. The topics are generally the same so all of the old exams should be useful for review.


Winter 2020
Exam   |   Sample Solution   |   Hsia
Autumn 2019
Exam   |   Sample Solution   |   Tang
Summer 2019
Exam   |   Sample Solution   |   Johnston
Spring 2019
Exam   |   Sample Solution   |   Hsia
Winter 2019
Exam   |   Sample Solution   |   Perkins
Autumn 2018
Exam   |   Sample Solution   |   Perkins
Summer 2018
Exam   |   Sample Solution   |   Perkins
Spring 2018
Exam   |   Sample Solution   |   Hsia
Autumn 2017
Exam   |   Sample Solution   |   Perkins
Summer 2017
Exam   |   Sample Solution   |   Perkins
Spring 2017
Exam   |   Sample Solution   |   Perkins
Summer 2016
Exam   |   Sample Solution   |   Perkins
Spring 2016
Exam   |   Sample Solution   |   Perkins
Winter 2016
Exam   |   Sample Solution   |   Perkins
Summer 2015
Exam   |   Sample Solution   |   Perkins
Spring 2015
Exam   |   Sample Solution   |   Perkins
Summer 2014
Exam   |   Sample Solution   |   Perkins
Spring 2014
Exam   |   Sample Solution   |   Perkins
Winter 2014
Exam   |   Sample Solution   |   Perkins
Summer 2013
Exam   |   Sample Solution   |   Perkins
Spring 2013
Exam   |   Sample Solution   |   Perkins
Summer 2012
Exam   |   Sample Solution   |   Perkins
Spring 2012
Exam   |   Sample Solution   |   Perkins