Midterm overview and scope
The midterm may cover any material taught in class or introduced by the homework assignments. A list of some likely exam topics is given in the next section:
Partial list of topics
The following is a partial list of topics that are at particularly likely to appear on the midterm, so be sure you have studied these well. Any of the following may be on the midterm but the higlighted items are ones that many students have failed to study sufficiently for previous exams:
- Storage of information in computer memories, including:
- Bits and their significance
- Differing interpretations of bits as numbers, characters, etc.
- Encodings of C language types on AMD 64
including both unsigned and signed (two's complement)
representations; floating-point representations, etc.
You must know how fixed and floating-point numbers are represented as bits,
and how arithmetic is done on those numbers. You must now the sizes
in bytes of types like
longand you must be familiar with types like
stdint.h. You must be familiar with alignment rules (e.g.
ints always have an address that's a multiple of 4) and you must know how to compute the size of a structure based on the declaration of its members — don't forget padding!
- Bit masking and shifting operations, use of flags, and packing of multiple values into a single word You must be capable of writing code on the exam to extract bits or bit fields from a word, set bit fields, test flags, etc. You must understand how multiplication and division can be done by shifting, and how to use C to choose between signed and unsigned shifts.
- Conversions between hex, binary and decimal representations
- Casting and assignment:
- Casting pointers including void pointers
- Casting between numeric types (e.g.
- Assignment and parameter passing involving type conversions
(e.g. assigning an
- Big endian and little endian storage conventions: you should be able to explain the differences, and to predict the bytes that will actually be stored, e.g. for some given integer or float
- Interfaces and abstraction: why they are important, and
programming techniques for implementing them
- Use of void pointers and incomplete structures for information hiding and abstraction
- Hansons's conventions for interface and ADT programming
- Polymorphism, including boxed and unboxed representations
- Invariants and why they matter
- The representation of programs in memory
- Code (text) segments, static initializing uninitialized data, Heap, stack, etc.
- The phases of program compilation, assembly,
linking, etc. and how they combine to create an executable
program. You should understand resolution of references to external
symbols by the loader (i. e., by the phase where
.ofiles are combined to create an executable).
- Locality and caching
- What do we mean by locality, and why do programs with better locality tend to perform well?
- Basics of computer memory hierarchies: memories, caches, and registers
- Differences between cache organizations: direct mapped, fully associative, and set associative
- Given details of a particular cache (line size,
associativity, number of lines, and if appropriate replacement
policy), you should be able to explain:
- Which address bits are tag bits, which are set selectors, and how the other bits are used for resolving memory references
- For a particular program that makes memory accesses, e.g. a program that strides through memory, what the hit rate and miss rate will be in the cache
- What will be in the cache at any point in a program's executaion. I.e., what the tag bits will be, what the Valid and Dirty bits will be, and therefore which memory location is cached, if any
For all of this, the Cache Simulator we introduced with the stride lab is a great tool for experimenting and checking your knowledge.
- You should know that when you reference a member of a structure, C loads or stores only the member, not the entire structure. You should understand how a loop going through an array of structs, always accessing the same member, will likely present a strided access pattern to the memory.
- C programming at the level we've done on our projects
including language features such
void *, argument passing by value, use of pointers to pass arguments by reference, basic uses of #define, etc.
Note that there may well be other topics on the test as well.
In general, we will not expect you to memorize picky details. For
example, we will expect you to understand key components of
floating-point representation, such as the significand, but if
needed we will remind you that in 32 bit IEEE floats, the
significand is 23 bits long. However, we will expect you to
have memorized the sorts of details that competent C programmers at
your level should know: for example, we expect you to know that
%s is the
printf format code for
printing a string, that
%d is for signed integers, etc.
Materials to review
The primary sources that are likely to be helpful to you in preparing for the test are the ones linked from our course calendar, including especially:
- All class notes including not only the PowerPoint slides used in class, but also the other notes link from the calendar
- Bryant and O'Hallaron, especially the chapters and sections called out in the calendar
Taking the test
The following rules and procedures apply to this test:
- The test is closed book; you may not refer to books, published materials, class notes, etc. during the test. You may bring and refer to a single page two-sided reference sheet. This sheet must be hand written by you; these sheets will be collected along with your exams, so please put your name on your reference sheet.
- You may not use any calculator or other electronic device during the test
- The test will be held during our usual class period and will be 75 minutes long