Final Exam Review for CS 201
Types
sizes are char <= short <= int <= long and float <= double
string is a class, not a built in type.
unsigned is a thing.
unsigned char is a thing.
Pointers
Address of a variable is &foo.
Can you take the address of an expression like this: &(1+2).
What does it mean to take the address of a pointer: &pointer
In parameter
passing, these are different
foo(int *f)
foo(int &f)
* dereferences.
int *a; *a = 1; // this is bad
int *a = 1; // this is also bad.
What does -> mean, and how does that relate to * and .
What happens if you follow a bad pointer.
Legal: pointer + int, pointer – int, pointer-pointer. Know what type this produces.
Arrays and pointers
An array name is like a read only pointer
data[5] == *(data+5)
pointer++ and pointer-- only make sense on arrays and move by sizeof(type)
Files. Know how to do these things:
ifstream
ofstream
fstream
tellg
seekg
read
write
getline
How do you open a file.
Which operations cause the file pointer to move, and how?
How can you decide if a file exists?
How can you find the file size?
How can you find the number of lines in a file.
If I give you a simple file format like WAV or BMP, know how to look up where some piece of data (like resolution or sample rate) is.
Assert command
Recursion
There is a base case and a one or more recursive cases.
Know how to do simple recursion examples
Standard Template Library
I expect you can look up stuff
When is a list, vector, or set the best choice?
Know hot declare a vector of ints, or a set of strings, etc.
Declare and use forward and reverse iterators
auto is useful here.
Templates
Know how to make a simple template example.
Know that the code normally goes in the *.h file.
Linked Lists
How to make, insert, delete, and search them.
Know storage costs
Know run time costs.