Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume each element of an array list, stored in row-major order, occupies four b

ID: 3560791 • Letter: A

Question

Assume each element of an array list, stored in row-major order, occupies four bites of storage. If array list is declared by each of the following, and the base address of the array is 100, find the address of the indicated array element. Please show all work.

Please show all steps and explain. I am not looking for a program to be written, so please do not give me that type of answer. Thank you!

Declaration Address integer list [1..100]; list [10] integer list [0..10, 0..20]; list [5, 10] integer list [-5..5, -1..12]; list [3, 8]

Explanation / Answer

Declaration           Address
integer list [1..100];       list [10]
integer list [0..10, 0..20];   list [5, 10]
integer list [-5..5, -1..12];   list [3, 8]

1-
list[10] is the 10th elment so 9 int available before this
memory req for 9 int=9*4=36
base address=100
required address=100+36=136
so list[10] starts from 137


2-
list[5,10] is the 116th (5*21+11) integer so 115 int available before this
memory req for 115 int=115*4=460
base address=100
required address=100+460=560
so list[5,10] starts from 561

3-
list[3,8] is the 108th (11*9+9) integer so 107 int available before this
memory req for 107 int=107*4=428
base address=100
required address=100+428=528
so list[5,10] starts from 529

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote