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

Given the following Java declarations and initializations: int aInt = 10; Intege

ID: 3856192 • Letter: G

Question

Given the following Java declarations and initializations: int aInt = 10; Integer aInteger = new Integer(10); int aArray[] = {1, 2, 3, 4, 5}; Illustrates how memories are allocated when each line of the Java statement is executed. Line 1 Line 2 Line 3 Design an ADT for kite. There are four sides a, b, c and d. The ADT should also include operation to calculate the perimeter of the kite. Additionally, there exist an operation to print information regarding the kite. Identify and explain the THREE (3) levels of data abstractions. Describe an advantage of double linked list over single linked list. Explain a situation where array implementation of list ADT is not recommended.

Explanation / Answer

a)

line 1:

In the first line a memory block of 4 bytes us allocated to the variable name aint which is initialised with the value 10

line 2:

In the second line instance of an object of type integer is created with the value 10 in ainteger.

So here heap memory is allocated 8 bytes of memory in which 4 bytes is for primitive field and another 4 is for reference field.

line 3:

Here an array is created which contains 5 blocks of int data type sp total 4*8= 32 bytes of memory is allocated and initialised with the value 1, 2, 3, 4, and 5.

c)

The three levels of data abstraction are given as follows:

Physical level: This is the lowest level of data abstraction and tells you that how data are stored.

Logical level: This level focuses on “What” and tells you that what data are stored in the database.

View Level: This level describes entire database.

d)

Doubly linked list provides more easy implementations of data structures compared to singly linked list.

You can traverse both ways if doubly linked list is given to you.

Deletion in doubly linked list is easy compared to singly linked list, because in singly linked list the address of previous node was required to delete a node.

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