Exam study guide
You're having an in-class exam next Wednesday. Here's a summary of the kinds of questions and the topics that might show up. Use this information as you see fit.
- Closed-everything-except-your-brain (no calculator, no notes)
- General topics
- data representation
- addresses/pointers & memory in general
- C
- My philosophy of in-class exams
- Stuff that I want you to have in your head, not just your notes
- Mostly "what" and "how", only a little bit of "why"
- No tricks
- I indicate what I think is most important via classroom topics, homework assignments, sample programs, quizzes
- What to study
- homework assignments
- quizzes
- sample code (notably output.c, bitwise.c, strings.c, args.c, byte-counter.c, pointers.c, memory.c)
- class notes)
- backup reference material as needed: textbook readings)
- Types of questions
- Short answers
- Here's some code; what's the output?
- Write this tiny amount of code to do X (never more than 3-4 lines)
- That memory grid from the Moodle quiz
- Wildcard (I reserve the right to come up with a different type of question, but see philosophy above)
- Integers
- binary/decimal/hexadecimal notation (octal, though important, will not be on the exam)
- two's complement representation
- byte order (little-endian vs. big-endian)
- Characters
- difference between characters and C char
- codepoints vs. encodings
- ASCII (chart will be provided)
- UTF-8 encoding (chart will be provided)
- UTF-16 BE and UTF-16 LE
- Don't forget: you can write your own experimental programs to see what happens when you do this or that
- C types
- int vs. long (32-bit vs. 64-bit)
- char *p vs. char p[10]
- string literals: "Hello"
- char literals: 'A', '\0', '\\', '\''
- sizeof (don't confuse with strlen!)
- C I/O (input/output)
- printf, %c, %s, %d, %x, %X, %p
- [unlikely to be on the test] fopen, fclose, fread, fwrite, fgetc
- Null-terminated char strings
- strlen
- strcpy vs. strncpy (including what happens if source is longer than buffer in strncpy)
- strcmp
- printf %s vs. %p
- C pointers
- & as unary "address-of" operator
- * in type declarations
- * as unary operator for dereferencing
- assignment statements with pointers
- C bitwise operators
- ~ (not)
- & (and)
- | (or)
- ^ (exclusive or, also known as xor)
- C stuff that's pretty much the same as Java
- if, else
- &&, ||, !
- while, for
- {}, ()
- +, -, / (int div), %
- function signatures