Question

In: Computer Science

Determine the memory address of A[3], A[10], A[20] a) given int A[] b) given short A[]...

Determine the memory address of A[3], A[10], A[20]

a) given int A[]

b) given short A[]

c) given char A[]

Solutions

Expert Solution

a) int datatype storage size is 4 bytes and consider the memory starts at 0x0000.

Memory address of A[3]:

3*4=12 bytes=0x000C(hexadecimal address)

Hence the memory address of A[3] is 0x000C.

Memory address of A[10]:

10*4=40 bytes=0x0028(hexadecimal address)(2*16+8)

Hence the memory address of A[10] is 0x0028.

Memory address of A[20]:

20*4=80 bytes=0x0050(hexadecimal address)(5*16+0)

Hence the memory address of A[3] is 0x0050.

b) short datatype storage size is 2 bytes and consider the memory starts at 0x0000.

Memory address of A[3]:

3*2=6 bytes=0x0006(hexadecimal address)

Hence the memory address of A[3] is 0x0006.

Memory address of A[10]:

10*2=20 bytes=0x0014(hexadecimal address)(1*16+4)

Hence the memory address of A[10] is 0x0014.

Memory address of A[20]:

20*2=40 bytes=0x0028(hexadecimal address)(2*16+8)

Hence the memory address of A[3] is 0x0028.

c) char datatype storage size is 1 byte and consider the memory starts at 0x0000.

Memory address of A[3]:

3*1=3 bytes=0x0003(hexadecimal address)

Hence the memory address of A[3] is 0x0003.

Memory address of A[10]:

10*1=10 bytes=0x000A(hexadecimal address)

Hence the memory address of A[10] is 0x000A.

Memory address of A[20]:

20*1=20 bytes=0x0014(hexadecimal address)(1*16+4)

Hence the memory address of A[3] is 0x0014.


Related Solutions

Given a memory address of 34Ah (10 bits) with 4 memory banks. Determine the memory bank...
Given a memory address of 34Ah (10 bits) with 4 memory banks. Determine the memory bank address and the address of the word in the bank using Low Order Interleaving (LOI).
Given the following memory values and address instruction with an accumulator. Determine the values with the...
Given the following memory values and address instruction with an accumulator. Determine the values with the following instructions load into accumulator. Word 16 contains 22 Word 18 contains 24 Word 20 contains 26 Word 22 contains 28 Word 24 contains 30 Word 26 contains 32 Word 28 contains 34 i. LOAD IMMEDIATE 16 ii. LOAD DIRECT 16 iii. LOAD INDIRECT 16 iv. LOAD IMMEDIATE 18 v. LOAD DIRECT 18 vi. LOAD INDIRECT 20 vii. LOAD IMMEDIATE 24 viii. LOAD DIRECT...
What's the memory address for the following elements arrays given: Base Address: 1000, Dimensions: 10 rows,...
What's the memory address for the following elements arrays given: Base Address: 1000, Dimensions: 10 rows, 5 columns, 4 byte elements. Elements: 0,0; 9,4; 2,2; 4,1; Base Address: 500, Dimensions: 10 rows, 15 columns, 4 byte elements. Elements: 0,0; 9,14; 2,2; 4,11; Base Address: 800, Dimensions: 4 rows, 5 columns, 2 byte elements. Elements: 0,0; 3,4; 2,2; 3,4;
Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The...
Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The number a is stored in Mem[0x10010000] and b is stored in Mem[0x10010004]. Write MIPS assembly code to swap the two numbers, load a to a register, b to another register and store a at Mem[0x10010004], store b at Mem[0x10010000].
int a = 3; int b = -2; if((a>0)&&(b>0)){ if (a>b) { System.out.println("A"); } else {...
int a = 3; int b = -2; if((a>0)&&(b>0)){ if (a>b) { System.out.println("A"); } else { System.out.println("B"); } } else if ((b<0)||(a<0)) { System.out.println("C"); } else { System.out.println("D"); }
6- Write a C++ program that determines the amount of memory used by char, short int,...
6- Write a C++ program that determines the amount of memory used by char, short int, unsigned short int, float, and double types and display the information on the screen. You program should also display the typical range for each data type.
Draw a memory layout to show the relations of a, b and c. char a[3][10] =...
Draw a memory layout to show the relations of a, b and c. char a[3][10] = {"abcdefg", "1234567", "!@#$%^&"}; char* b[3]; char** c; b[0] = &a[0][0]; b[1] = &a[1][0]; b[2] = &a[2][0]; c = b; char x = b[0][3]; char y = b[0][13];
what is the output? int main ( ) { int a = 3, b= 2, c=...
what is the output? int main ( ) { int a = 3, b= 2, c= 1, d, e, f, g; d = a&b;    e = a | c; f = a >> 1, g = a << 1; cout << “d= “ << d << “ e = “ << e << “ f = “ << f << “g = “ << g << endl; }
3. For the given data 10, 8, 3, 2, 3, 10, find (a) Median (b) Mean...
3. For the given data 10, 8, 3, 2, 3, 10, find (a) Median (b) Mean (c) Mode (d) Standard deviation (e) Range (f) Interquartile range, IQR 4. For the date 4, 16, 20, 24, 38, 57, 59, 60, 60, 74, compute the 10% trimmed mean. 5. Let ? and ? be any two events with their probabilities as ?(?) = 0.42 and ?(?)= 0.24. (a) Find ? (??? ?) (b) If the two given events are mutually exclusive, find...
Given the root C++ code: void sort() {    const int N = 10;    int...
Given the root C++ code: void sort() {    const int N = 10;    int x[N];    for(int i = 0; i < N; i++)    {        x[i] = 1 + gRandom-> Rndm() * 10;        cout<<x[i]<<" "; }    cout<<endl;    int t;       for(int i = 0; i < N; i++)    {    for(int j = i+1; j < N; j++)    {        if(x[j] < x[i])        {   ...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT