Contents

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) Array in which elements are not present in continuous locations

a

Explanation: It compactly stores bits and exploits bit-level parallelism.


Which of the following bitwise operations will you use to set a particular bit to 1?
a) OR                                    
b) AND
c) XOR                                  
d) NOR

a

Explanation: 1 OR 1 = 1, 0 OR 1 = 1, any bit OR’ed with 1 gives 1.


Which of the following bitwise operations will you use to set a particular bit to 0?
a) OR                                    
b) AND
c) XOR                                  
d) NAND

b

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


Which of the following bitwise operations will you use to toggle a particular bit?
a) OR                                    
b) AND
c) XOR                                  
d) NOT

c

Explanation: 1 XOR 1 = 0, 0 XOR 1 = 1, note that NOT inverts all the bits, while XOR toggles only a specified bit.


Which of the following is not 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) Accessing Individual
 Elements is easy

d

Which of the following is not a disadvantage of bit array?
a) Without compression, they might become sparse
b) Accessing individual bits is expensive
c) Compressing bit array to byte/word array, the machine also has to support byte/word addressing
d) Storing and Manipulating in the register set for long periods of time

d