Computer Science 215 Quiz 4 Name ______________________ 1. Fill in the FINAL values in the table below after ALL of the code shown has completed execution: x = 22; name value address y = 9; ------------------------------ p = &x; int x | | 120 r = &y; ------------------------------ *p = *r; int y | | 116 *r = x; ------------------------------ p = r; int *p | | 112 ------------------------------ int *r | | 108 ------------------------------ 2. Suppose the following declarations are made in a program to be run on an Intel x86 computer. char *x; short *y long *z; a. Each of the three pointer b. The three pointer variables consume variables consumes 4 bytes 1, 2, and 4 bytes respectively of space. c. Each of the three pointer variables consumes 1 byte of space. 3. Which best characterizes the behavior of the following program: main() { int* p; *p = 99; printf("The value is %d \n", *p); } a. The program is correct and b. The program is incorrect should be expected to work and will fail in all environments fine in all environments before the printf() is executed c. The program is incorrect, but it may appear to work correctly. 4. The proper way to use fread to copy stdin to stdout until end of file is: a. while (len = (fread(buff, 1, 1024, stdin) != 0)) fwrite(buff, 1, len, stdout); b. while ((len = fread(buff, 1, 1024, stdin)) != 0) fwrite(buff, 1, len, stdout); c. while (len = fread(buff, 1, 1024, stdin) != 0) fwrite(buff, 1, len, stdout); d. All of the above are equivalent and correct.