CSE 333 22au Midterm 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, and questions may be based on
any of the work we've done this quarter. A good way to
study is to take some of the old exams in a quiet room and limited to the
50 min. time allowed for the real exam before looking at the sample solutions.
Some of the practice exercises at the end of most
lectures can also be useful for studying if you haven't done them already.
You should understand the ideas and core concepts and how to use
them, but don't memorize API details. We'll provide hints or reference
material on the exam
for API details as needed, but you should know the basics.
The exam will be closed book, except that you may have one 5x8
(or smaller) index card with whatever notes you wish written on both sides for reference.
The notes must be hand-written, i.e., no computer printouts, no scanned/reduced
notes, and no electronic devices or other technology.
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.) and when to use them
- 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.;
basics of directory reading API
- Relationship between C standard library, POSIX library
functions, and system calls
- Error handling - error codes and errno; error handling/retry for POSIX read/write
- 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 to approximate 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 executed 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)
- Templates and libraries
- Basics of templates - template parameters for classes and
functions, when templates are expanded with actual types,
templates and header files.
- Basics of STL containers and iterators.
You are not expected to know picky details but you should be able
to use basic conainers (vector, list, map) and iterators to process them
at the level covered in exercises.
- Inheritance and other topics not reached until right before the exam
will not be included on the midterm