Exam 1 Version 1 Solutions CS 213 Spring 2011 ********* Problem 1 ********* 1. a 2. d 3. c 4. a 5. b 6. a 7. d 8. b 9. b 10. a 11. d 12. b ********* Problem 2 ********* A. abc, bac B. 213 ********* Problem 3 ********* A. 1. 16*64 + 32*64 = 3072 2. 32*64 = 2048 3. 16*64 = 1024 4. (24*64)/(16*64 + 32*64) = 1536/3072 = 1/2 B. 1. 32*64 = 2048 2. 32*64 = 2048 3. 0 4. (24*64)/(32*64) = 1536/2048 = 3/4 ********* Problem 4 ********* A. 1024 B. 4 MB C. ---------------------- | 0 | kernel memory | |--------------------| | 1 | kernel memory | |--------------------| | 2 | kernel memory | |--------------------| | 3 | kernel memory | |--------------------| | 4 | text and data | |--------------------| | 5 | text and data | |--------------------| | 6 | text and data | |--------------------| | 7 | unallocated | |--------------------| | 8 | heap | |--------------------| | 9 | heap | |--------------------| | 10 | unallocated | |--------------------| | 11 | unallocated | |--------------------| | 12 | unallocated | |--------------------| |....| unallocated | |--------------------| |n-12| unallocated | |--------------------| |n-11| unallocated | |--------------------| |n-10| unallocated | |--------------------| | n-9| unallocated | |--------------------| | n-8| unallocated | |--------------------| | n-7| unallocated | |--------------------| | n-6| unallocated | |--------------------| | n-5| unallocated | |--------------------| | n-4| unallocated | |--------------------| | n-3| stack | |--------------------| | n-2| stack | |--------------------| | n-1| stack | ---------------------- ********* Problem 5 ********* A. ------------------- | VA | PA | |-----------------| | 0x7E85 | 0x9585 | |-----------------| | 0xD301 | ------ | |-----------------| | 0x4C20 | 0x3020 | |-----------------| | 0xD040 | ------ | |-----------------| | ------ | 0x5830 | ------------------- ********* Problem 6 ********* A. ---------------------------------------------------------- | File | Symbol | Strength/scope | Value | ELF section | |--------------------------------------------------------| | | x | weak global | - | .data | | |-----------------------------------------------| | | y | weak global | - | .data | | main.o |-----------------------------------------------| | | z | strong global | 0 | .data | | |-----------------------------------------------| | | main | strong global | - | .text | |--------------------------------------------------------| | | x | strong global | 5 | .data | | foo.o |-----------------------------------------------| | | y | strong global | 2 | .data | ---------------------------------------------------------- ********* Problem 7 ********* A. AABCBCD