Quiz submission record for quiz2-1-1 at Mon Jun 28 01:50:52 2004: Your Answer for Question 1: a. False: It does not always remove the number of free blocks because b and c are true. But, a situation where it does reduce the number of free blocks is when a block in the free space exactly fits the amount that is required. A time that it does not is when the allocated memory is part of a block that is bigger than the memory required. Then, the excess memory is still retained in the free list, so the number of free blocks remained unchanged. b. True: In the event that the memory needed is less than the size of the block of memory that is available, the excess memory is retained in the free list, so the number of blocks remains unchanged. c. True: When none of the existing free blocks of memory are large enough to contain the memory we are allocating, the program requests a new, large block of memory from the OS. If what we are allocating is less than this, the excess is added to the free list, so the number of free blocks is increased by one. Your Answer for Question 2: a. False: When the block we free is between two already allocated blocks, it does increase the number of free blocks by one. However, if it is adjacent to any free blocks, the free blocks are consolidated and the number of free blocks is either unchanged or reduced. b. True: If the block that we free is next to exactly one free block, they are consolidated, and the number of free blocks is unchanged. c. False: If a single block of memory is between two other free spaces, then freeing it will cause all three of those spaces to consolidate, reducing the number of free blocks by one. However, it can be reduced by more than one. d. True: If the block of memory that we are freeing is not contiguous, then potentially every fragment of it could be between two free blocks of memory, thus reducing the number of free blocks by two or more. Your Answer for Question 3: The Java equivalent is "new" and class constructors. Java does not have an exact equivalent to free, but declaring references that pointed to an object null and the garbage collection of the Java Virtual Machine take over the job of freeing memory. Although it is not impossible to build an automatic allocation/deallocation system for C (after all, that is where Java came from), the idea of pointers does complicate things (you can potentially have an address to a block of memory of garbage) and it reduces the freedom of the programmer Your Answer for Question 4: It can be reclaimed using reference. The top left structure has no references to it, so it is reclaimed. That leads the top right and bottom left structures to be reclaimed because they no longer have any references pointing to them, which then caues the bottom right structure to be reclaimed. It can be reclaimed using the mark and sweep method if none of the objects in the picture are roots (can be accessed by the programmer). In that case, they will not be marked, and thus they will be removed during the sweep phase. Your Answer for Question 5: Reading the notes on memory allocation, I was under the impression that when we required a block of memory that didn't fit into any existing blocks of memory that we had, the program would request a new block of memory from the OS. However, I also thought that memory that we needed could be fragmented, with bits and pieces stored in chunks with pointers, like a linked list. Your unique submission ID is quiz2-1-1-cs61c-el-1088412652-1302.