Dynamic Array | Data Structure MCQs


What is a dynamic array?

   A.) A variable size data structure
   B.) An array which is created at runtime
   C.) The memory to the array is allocated at runtime
   D.) An array which is reallocated everytime whenever new elements have to be added

Answer: Option 'A'

A variable size data structure


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[];

Answer: Option 'A'

ArrayList al = new ArrayList();


In what type of dynamic array do you divide the array into two parts?

   A.) Hashed Array Tree
   B.) Geometric Array
   C.) Bounded-size dynamic array
   D.) None of these

Answer: Option 'C'

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


What is the time complexity for inserting/deleting at the beginning of the array?

   A.) O(1)
   B.) O(n)
   C.) O(logn)
   D.) O(nlogn)

Answer: Option 'B'

All the other elements will have to be moved, hence O(n).


What are the advantages of dynamic arrays?

   A.) Locality of reference
   B.) Data cache utilization
   C.) Random access
   D.) All of these

Answer: Option 'D'

Dynamic arrays share the advantage of arrays, added to it is the dynamic addition of elements to the array.

Dynamic Array | Data Structure MCQs Download Pdf