Bit Array | Data Structure MCQs

1.

Which of the following is an advantage of bit array?

   A.) Exploit bit level parallelism
   B.) Maximal use of data cache
   C.) Can be stored and manipulated in the register set for long periods of time
   D.) All of these

Answer: Option 'D'

Because bit arrays are compact, they outperform many other data structures.

2.

Which class in Java can be used to represent bit array?

   A.) BitSet
   B.) BitVector
   C.) BitArray
   D.) BitStream

Answer: Option 'A'

The BitSet class creates a special type of array that can hold bit values.

3.

Which of the following bitwise operations will you use to set a particular bit to 0?

   A.) OR
   B.) AND
   C.) XOR
   D.) NAND

Answer: Option 'B'

1 AND 0 = 0, 0 AND 0 = 0, any bit AND with 0 gives 0.

4.

What are some of the applications of bit arrays?

   A.) Used by the Linux kernel
   B.) For the allocation of memory pages
   C.) Bloom filter
   D.) All of these

Answer: Option 'D'

Used in priority queues data structure in the Linux kernel, for allocation of memory pages, a bitmap is used.

5.

What is a bit array?

   A.) Data structure for representing arrays of records
   B.) Data structure that compactly stores bits
   C.) An array in which most of the elements have the same value
   D.) None of these

Answer: Option 'B'

It compactly stores bits and exploits bit-level parallelism.

Bit Array | Data Structure MCQs Download Pdf