MCQOPTIONS
Saved Bookmarks
| 1. |
Suppose you are compiling on a machine with 1-byte chars, 2-byte shorts, 4-byte ints, and 8-byte doubles, and with alignment rules that require the address of every primitive data element to be an integer multiple of the element's size. Suppose further that the compiler is not permitted to reorder fields: padding is used to ensure alignment. How much space will be consumed by the following array?struct {short s;char c;short t;char d;double r;int i;} A[10]; /*10-element array of structs*/ |
| A. | 150 bytes |
| B. | 320 bytes |
| C. | 240 bytes |
| D. | 200 bytes |
| Answer» D. 200 bytes | |