Contents

Which of the following is/are not applications of bit arrays?
a) Used by the Linux kernel
b) For the allocation of memory pages
c) Bloom filter
d) Implementation of Vectors and Matrices

d

Explanation: Normal Arrays are used to implement vectors and matrices. Bit arrays have no prominent role. Remaining all are applications of Bit Arrays.


Which class in Java can be used to represent bit array?
a) BitSet                                               
b) BitVector
c) BitArray                           
d) BitStream

a

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


Which of the following bitwise operator will you use to invert all the bits in a bit array?
a) OR                                    
b) NOT
c) XOR                                  
d) NAND

b

Explanation: NOT operation is used to invert all the bits stored in a bit array.
Eg: NOT (10110010) = 01001101.


What does Hamming weight/population count mean in Bit arrays?
a) Finding the number of 1 bit in a bit array
b) Finding the number of 0 bit in a bit array
c) Finding the sum of bits in a bit array
d) Finding the average number of 1’s and 0’s in bit arrays

a

Explanation: Hamming/ population count involves finding the number of 1’s in the bit array. Population count is used in data compression.


Which one of the following operations returns the first occurrence of bit 1 in bit arrays?
a) Find First Zero
b) Find First One
c) Counting lead Zeroes
d) Counting lead One

b

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

a

Explanation: It is a varying-size list data structure that allows items to be added or removed, it may use a fixed sized array at the back end.