CSE 333 18su Midterm Exam Topics

This list is a summary of the topics we've covered in class so far that could potentially be on the midterm. Generally, if you've kept up with everything that's been covered in lecture, sections, exercises, and homework assignments you should be well prepared. A good way to study is to take some of the old exams before looking at the sample solutions and to work some of the practice exercises at the end of most lectures if you haven't done them already.

General program organization and where C fits in the ecosystem

  • System layers: C language, libraries, and operating system
  • General workflow needed to build a program – preprocessor, compile, link
  • Preprocessor – how #include, #define, #ifndef and other basic commands rewrite the program
  • 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 – what needs to be recompiled when something changes (dependency graph behind make and similar tools)
    • Make and makefile basics – how build dependencies are encoded in makefile rules
    • More tools: basics of using git for version control (add/commit/push, primarily), what to put in a repository and what to leave out

C language and program execution

  • Review: standard types, operators, functions, scope, parameters, strings, etc.
  • Extended integer types (int32_t, uint64_t, etc.)
  • Standard I/O library and streams: stdin, stdout, fopen, fread, scanf, printf, etc.
  • POSIX libraries – wrappers for system 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 (heap)
    • Stack and function calls – what happens during function call, return
  • Function parameters
    • Call by value semantics (including structs, pointers)
    • Arrays as parameters - pointers
    • Using pointers for call-by-reference semantics
    • Function pointers as parameters
  • Pointers, pointers, pointers - &, *, and all that
    • Typing rules and pointer arithmetic (what does p+1 mean?)
    • Relationship between pointers and arrays, a[i] and pointer arithmetic
    • String constants, arrays of characters, C string library
    • Using void* as a “generic” pointer type
    • Casting
    • Dynamic allocation (malloc, free)
    • Potential bugs – memory leaks, dangling pointers (including returning pointers to local data), etc.
    • Be able to draw and read diagrams showing storage and pointers, and be able to trace code that manipulates these things.
  • Structs – how to define and use; meaning of p->x  ( = (*p).x ); structs as local variables, parameters, and return values (value semantics) vs. heap-allocated structs; struct values vs pointers to structs
  • Typedef – how to define and use
  • Linked data structures in C – linked lists, hash tables, etc.

C++

  • Classes and modularity, namespaces
    • Be able to read and create simple class definitions and add to them, implement functions, trace code, etc.
    • Know the difference between constructors, copy constructors, and assignment and when these are executed
    • Know what a destructor is and when it gets called and what it should do
  • 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)

The midterm will not include C++ templates, STL, smart pointers, inheritance and later topics that have not been covered yet. Those will be on the final exam.