File I/O
Memory Management
Pointers
Strings
Random
100

Opens char *filename in binary read mode

What is fopen(filename, "rb")?
100

Where the address of things change every time a program executes

What is Address Space Randomization Layout or ASLR?

100

This is a postfix traversal of a tree.

What is LRN?

100

This is a function you want to use to prevent buffer overflows.

What is strncpy()?

(BONUS 100 for anyone if can provide other functions with justification as to how it prevents buffer overflows)

100

This gdb command prints out the call stack

What is bt?

200

access() is used for this.

What function tells you whether the calling process can access the file path?

200

This grows in the direction of increasing addresses.

What is the heap?

200

These are two things that must be in a struct for a doubly-linked list to be possible.

What is the previous pointer and the next pointer?

200

This is a string that cannot change and allocates a pointer on the stack. It's defined as: char *str = "Hello!";

What is a string literal?

(BONUS 100 points: Where is the string array stored?)

200

This is static but with local variables

What is the storage class where, if utilized, the data is initialized only once and retains its value between invocations of the function?

300

Moves your file pointer fp in the file to 10 characters before the end

What is fseek(fp, -10, SEEK_END)?

300

This is the difference between little endian and big endian.

Little endian: least-significant byte stored first

Big endian: most significant byte stored first

300

This is used to print the address of where the pointer is pointing to

%p

300

If this does not exist in the string, strcpy and strcmp will fail

What is a null terminator?

300

This is the full function header for the function that copies everything from the source SDL_Surface to the destination SDL_Surface

what is

int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) ?

400

This is used with fprintf so that fprintf operates exactly how printf operates.

stdout

400

I want to access arr[i][j], but arr was defined as a 1d array. How do you access arr[i][j] without ever using brackets?

*((*(arr+i)) + j)

400

When conducting pointer arithmetic, pointers move based on this.

What is the size of the variable that the pointer is pointing to?

400

What is incorrect about this code:

char *copy_over(char *msg) {

char *dest = calloc(20*sizeof(char)); assert(dest);

strncpy(dest, msg, strlen(msg));

printf("Success\n"); return dest; }


Strncpy should use the length of dest, NOT the length of msg

400

This flag tries to "register" variables, compares multiple lines for optimization

-O, -O1

500

char word[10]; int count; float value;

int ret = scanf(/* format string */, word, &count, &value);

This format string ensures that ret will equal 3 after reading any of the following lines:

mich)ael /42:3.14

#offi_e* /7:0.5

Scott#( /100:25.0

What is "%9[^/]/%d:%f"?

500

This is the size of the following struct:

struct paper {int count; double price; char type; struct paper* next;}

What is 32 bytes?

(BONUS 100: Can you make the size smaller? If so, what would the smaller size be?)

500

This is a pointer to a function that accepts 2 integers and returns an integer, and is initialized to NULL.

What is

int (*ptr_to_func)(int,int) = NULL; ?

500

This is what ret equals when the following function is called.

int ret = strcmp("DunderMifflen", "paperCompany");

-1

500

Mode in which core components of operating system run, providing them with unrestricted access to all hardware and system resources

What is kernel mode?