Computer Science 215 Quiz E Name ______________________ 1. Suppose the location of the viewpoint is V and the world coordinates of point on the screen through which a ray passes is W. A unit vector in the direction of the ray is then given by a. V / ||W|| b. W / ||W|| c. (W - V) / || W - V || d. (V - W) / || V - W || 2. The location of the hitpoint H is given by H = B + tD where a. B represents the point where b. D represents the point where the ray passes through the the ray passes through the screen and D is a unit vector screen and B is a unit vector in the direction of the ray in the direction of the ray c. B represents the viewpoint d. D represents the viewpoint and D is a unit vector and B is a unit vector in the direction of the ray in the direction of the ray 3. If a C program mallocs an area of memory and fails to free it, a. A garbage collector built b. The OS will reclaim all of the into the C language will memory used by the program including reclaim it unfreed malloc'd areas when the program exits. c. The memory will remain unusable d. The memory will remain permanently until the system is rebooted allocated and the computer will eventually have to be sent back to the factory for memory replacement 4. The correct approach to avoiding memory leaks is to free a malloc'd object a. whenever a function that has b. whenever the LAST pointer to the a local variable that points object is about to be reset or to to it returns go out of active scope. c. both of the above are true. 5. Assuming "lst" points to the head of one of our object lists, which best characterizes the following code fragment: obj_t *temp = malloc(sizeof(obj_t)); temp = lst->head; a. it will cause a memory leak b. it will cause a seg fault c. it is the correct way to set temp to point to the first object in the list.