Quiz submission record for quiz2-1-1 at Mon Jun 28 10:16:35 2004: Your Answer for Question 1: I'd say B and C, since malloc will only reduce the number of free blocks if the amount of memory the user wants is exactly equal to the size of the block malloc finds. Otherwise if it finds a block larger than the amount the user requests, it will take that amount from the block for the user and leave the remaining space in the block, thus the number of blocks in the free list is still the same. The final case is that malloc searches the whole free list and doesn't find a block that meets the user's requirements so it requests a new block from the operating system, large enough so that only a portion of the new block is returned to the user. In this case the number of blocks in the free list is increased! Your Answer for Question 2: I'd have to say B and C. Again, if the memory you are freeing up is not adjacent to any other free blocks, the number of free blocks in the list will increase, but this is not always the case. If the memory being freed up is adjacent to only one of the free blocks it is between in the list, then the two chunks will fuse into a single free block, thus the number of blocks after that call to free remains unchanged. If the memory being freed is adjacent to BOTH of its neighbors in the list, then they will all merge into one free block and the number of blocks in the list decreases by one. The number of blocks in the free list will never decrease by 2 or more as a result of a call to free. Your Answer for Question 3: The Java equivalent to malloc in C is "new". Java has no equivalent to free in C. It just deallocates storage when it is no longer needed (garbage collector). Someone can't build an automatic memory allocation / deallocation system for C, because in C, memory allocation is manual and memory must be explicitly allocated /freed by the programmer. It's difficult to determine automatically when a particular piece of storage is no longer needed and may be recycled for use in future allocations. Your Answer for Question 4: Yes, both methods will work. Since the structure is not circular, the reference count method works since it is possible to have 0 pointers pointing at the storage. Since the mark and sweep method will reclaim any structures not linked to the roots of the rest of the reachable objects, it works just as well as the reference count method for this particular structure. Your Answer for Question 5: C code for various functions, headers, etc was confusing and annoying to read since I didn't understand it all. I'd rather just read the explanations of what the C code does than trying to understand the C code itself. Your unique submission ID is quiz2-1-1-cs61c-fz-1088442995-254.