100% Guaranteed Results


CMSC 203 Lab 5 Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

Memory Mapping

1. Draw the memory map of the following variable int w and one-dimensional array of type int.
int w = 14;
int [] x = new int [8];

Stack: Heap:

2. Draw the memory map of the following two-dimensional ragged array of ints.

int[][] y = {{4, 8, 15}, {16, 23, 42, 10}, {8, 30}};

Stack: Heap:

3. Draw the memory map of the following one-dimensional array of type String.

String[] z = new String[4]; for (int i = 0; i < z.length; i++) { z[i] = “element ” + i;
}
Stack: Heap:

4. a. Write a shallow copy of the following in code. (Assume the five animal objects are already instantiated.)
Animal[] zoo = {tiger1, elephant2, giraffe3, monkey4, ape5}; Animal[] copy;

b. Draw the memory map.
Stack: Heap:

5. a. Write the deep copy of the following in code.
Animal[] zoo = {tiger1, elephant2, giraffe3, monkey4, ape5};
Animal[] copy;

b. Draw the memory map.
Stack: Heap:

6. What is garbage collection? Where does it happen?

7. What is the difference between the two operators, equals() and ==?

Reviews

There are no reviews yet.

Be the first to review “CMSC 203 Lab 5 Solved”

Your email address will not be published. Required fields are marked *

Related products