Lab Week 6 Worksheet

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CS261 Machine Organization

(Prof. Theys)
Lab Week 6

Name: UIN:

Name: UIN:

Please answer the following questions about two arrays “myArray” and “cube” declared in the
provided C code. (100 Points)

myArray - 1d array of type short

1) What is the starting address of myArray ( address of element myArray[0] )? (5 points)

2) What is the address of myArray[1]? (5 points)

3) What is the address of myArray[9]? (5 points)

4) What values (in hex) can the least significant nibble of the ​address​ for myArray​[i]​ be? (10
points)
5) What is the equation to find the address of element myArray[i]? (10 points)

cube - 3d array of type short

6) What is the starting address of cube (address of element cube[0][0][0])? (5 points)

7) What is the starting address of the second ​row​ of cube (address of element cube[0]​[1]​[0])? (5
points)

8) How many bytes are there in a row of cube? (10 points)

9) What is the starting address of the second ​plane​ of cube (address of element cube​[1]​[0][0]);
(5 points)
10) How many bytes are in a plane of cube? (10 points)

11) What is the equation required to determine the address of cube[i][j][k]? Your answer should
use i,j,k in the equation and information from questions 6-10. (20 points)

12) If the 3d array cube, is changed to be a struct of size 32 bytes instead of short, how would
your equation in 11 change? (10 points)

You might also like