Array Quiz for DSA

Last Updated :
Discuss
Comments

Question 1

Which option correctly define the advantages of array?

  • A

    Arrays allow random access and cache friendliness due to contiguous memory allocation.

  • B

    Arrays allow efficient insertions and deletions in the middle.

  • C

    Arrays provide low memory usage by storing references instead of actual data.

  • D

    Arrays are slower than other data structures in accessing elements.

Question 2

The first Index of the array typically starts from -----

  • A

    -1

  • B

    1

  • C

    0

  • D

    None of the Above

Question 3

Which method is used to access elements in an array?

  • A

    Sequential

  • B

    Random

  • C

    Logarithmic

  • D

    Alternative

Question 4

How are arrays stored in memory?

  • A

    Each element is stored at a random memory location.

  • B

    All elements are stored in a contiguous block of memory.

  • C

    Arrays are stored in reverse order.

  • D

    Elements are dynamically linked to the next element in memory.

Question 5

What are the disadvantages of static arrays?

  • A

    Data structures like queue or stack cannot be implemented

  • B

    There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

  • C

    Index value of an array can be negative

  • D

    Elements are sequentially accessed

Question 6

How are elements of dynamic array stored in the memory

  • A

    Each element is stored at a random memory location.

  • B

    Elements are dynamically linked to the next element in memory.

  • C

    Each element is stored in a contiguous memory locations

  • D

    Elements are grouped and each group is stored at a random memory location .

Question 7

What is the difference between declaring and initializing an array?

  • A

    Declaring an array specifies its size, while initialization gives it values

  • B

    Initialization creates an empty array, and declaration assigns values to it

  • C

    Declaring an array also initializes it to default values

  • D

    There is no difference between declaring and initializing an array

Question 8

What is a 2d array?

  • A

    An array where each element is a single value.

  • B

    An array that stores elements is a single row.

  • C

    an array of arrays or a matrix consisting of rows and columns.

  • D

    An array that contains only integers.

Question 9

How are the elements accessed in a 2d array ?

  • A

    array(i, j)

  • B

    array[i, j]

  • C

    array[ i ][ j ]

  • D

    array{ i }{ j }

Question 10

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

  • A

    O(1)

  • B

    O(N log N)

  • C

    O(log N)

  • D

    O(N)

Tags:

There are 20 questions to complete.

Take a part in the ongoing discussion