Contents

What is meant by physical size in a dynamic array?
a) The size allocated to elements
b) The size extended
 to add new elements
c) The size of the underlying array at the back-end
d) The size visible to users

c

Explanation: Physical size, also called array capacity is the size of the underlying array, which is the maximum size without relocation of data.


The number of items used by the dynamic array contents is its………
a) Physical size    
b) Capacity
c) Logical size    
d) Random size

c

Explanation: The number of items used by the dynamic array contents is called logical size. Physical size is the size of the underlying array, which is the maximum size without reallocation of data.


How will you implement dynamic arrays in Java?
a) Set                                     
b) Map
c) HashMap                        
d) List

d

Explanation: ArrayList is used to implement dynamic arrays in Java.


Which of the following is the correct syntax to declare an ArrayList in Java?
a) ArrayList al = new ArrayList();
b) ArrayList al = new ArrayList[];
c) ArrayList al() = new ArrayList();
d) ArrayList al[] = new ArrayList[];

a

Explanation: This is a non-generic way of creating an ArrayList.


Array is divided into two parts in……….
a) Hashed Array Tree
b) Geometric Array
c) Bounded-size dynamic array
d) Sparse Array

c

Explanation: The first part stores the items of the dynamic array and the second part is reserved for new allocations.


Which of the following is a disadvantage of dynamic arrays?
a) Locality of reference
b) Data cache utilization
c) Random access              
d) Memory leak

d

Explanation: Dynamic arrays share the advantage of arrays, added to it is the dynamic addition of elements to the array. Memory can be leaked if it is not handled properly during allocation and deallocation. It is a disadvantage.