The assignment content involves memory mapping exercises for one-dimensional and two-dimensional arrays of integers and strings. It also covers shallow and deep copies of string arrays. Additionally, it touches on garbage collection and the difference between equals() and == operators.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
1|P a g e CMSC 203 Spring 2016 - Lab 5 Memory Mapping Worksheet 1.Draw the memory map of the following one-dimensional array of type int. 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:
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
2|P a g e 3.Draw the memory map of the following one-dimensional ragged 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 the shallow copy of the following. String[] progLang = {"Algol", "Cobol", "Python", "Java", "Prolog"}; b.Draw the memory map. Stack:Heap:
3|P a g e 5.a.Write the deep copy of the following. String[] progLang = {"Algol", "Cobol", "Python", "Java", "Prolog"}; b.Draw the memory map. Stack:Heap: a. b. c. d. e. f. g. h. 6.What is garbage collection? Where does it happen? 7.What is the difference between the two operators, equals() and ==?