Suppose you have the following array declaration in a program.

```
int yourArray[5];
```
\Further suppose that in the implementation of C++ you are using an int that requires
4 bytes.
i) When your program runs, how much memory is required for this array?
ii) Suppose further that your array starts at memory location decimal 100. What will be the address of yourArray[3]?
iii)If you wrote to the (illegal) index 7 position in yourArray to what address would
this clobber?
a) i) The array takes 5 bytes,
```
ii) yourArray[3]
```will be anlocated at Address
103. iii) writing to yourArray[7] will clobber an int starting at location 107.
b) i) The array takes 10 bytes, ii)
```
yourArray[3]
```will be an int located at
Address 106. iii) writing to yourArray[7] will clobber an int starting at
location 114
c) i) The array takes 20 bytes, ii)
```
yourArray[3]
```
will be an int located at
Address 112 iii) writing to
```
yourArray[7]
```will clobber an int starting at
location 128
d) The purpose of a high level language is to insulate the programmer from these
details. It isn’t possible to know this without probing the source to the operating
system and the compiler, or extensive debugging.

c) is correct.

Computer Science & Information Technology

You might also like to view...

________ combines the flexibility of HTML with the addition of Extensible Markup Language.

a. XHTML b. HXML c. HTML d. XML

Computer Science & Information Technology

To organize predefined classes so that they can be found more quickly, Java stores related classes in groups called ____.

A. libraries B. collections C. bundles D. packages

Computer Science & Information Technology