Data Structure MCQ - Bit Array
Q1.Which of the following bitwise operator will you use to invert all the bits in a bit array
- NOT
- NAND
- OR
- AND
Answer:- (A).
Explanations :
Explanations :
- Used by the Linux kernel
- Bloom filter
- For the allocation of memory pages
- All of these
Answer:- (D).
Explanations :Used in priority queues data structure in the Linux kernel, for allocation of memory pages, a bitmap is used.
Explanations :Used in priority queues data structure in the Linux kernel, for allocation of memory pages, a bitmap is used.
- BitSet
- BitStream
- BitVector
- BitArray
Answer:- (A).
Explanations :The BitSet class creates a special type of array that can hold bit values.
Explanations :The BitSet class creates a special type of array that can hold bit values.
- OR
- AND
- XOR
- NOT
Answer:- (C).
Explanations :1 XOR 1 = 0, 0 XOR 1 = 1, note that NOT inverts all the bits, while XOR toggles only a specified bit.
Explanations :1 XOR 1 = 0, 0 XOR 1 = 1, note that NOT inverts all the bits, while XOR toggles only a specified bit.
- Exploit bit level parallelism
- Maximal use of data cache
- Can be stored and manipulated in the register set for long periods of time
- Accessing Individual Elements is easy
Answer:- (D).
Explanations :Individual Elements are difficult to access and can’t be accessed in some programming languages. If random access is more common than sequential access, they have to be compressed to byte/word array. Exploit Bit parallelism, Maximal use of data cache and storage and manipulation for longer time in register set are all advantages of bit array.
Explanations :Individual Elements are difficult to access and can’t be accessed in some programming languages. If random access is more common than sequential access, they have to be compressed to byte/word array. Exploit Bit parallelism, Maximal use of data cache and storage and manipulation for longer time in register set are all advantages of bit array.
- Without compression, they might become sparse
- Accessing individual bits is expensive
- Compressing bit array to byte/word array, the machine also has to support byte/word addressing
- Storing and Manipulating in the register set for long periods of time
Answer:- (D).
Explanations :Bit arrays allow small arrays of bits to be stored and manipulated in the register set for long periods of time with no memory accesses because of their ability to exploit bit-level parallelism, limit memory access, and maximally use the data cache, they often outperform many other data structures on practical data sets. This is an advantage of bit array. The rest are all disadvantages of bit array.
Explanations :Bit arrays allow small arrays of bits to be stored and manipulated in the register set for long periods of time with no memory accesses because of their ability to exploit bit-level parallelism, limit memory access, and maximally use the data cache, they often outperform many other data structures on practical data sets. This is an advantage of bit array. The rest are all disadvantages of bit array.
- BitSet
- BitVector
- BitArray
- BitStream
Answer:- (A).
Explanations :The BitSet class creates a special type of array that can hold bit values.
Explanations :The BitSet class creates a special type of array that can hold bit values.
- Finding the number of 1 bit in a bit array
- Finding the number of 0 bit in a bit array
- Finding the sum of bits in a bit array
- Finding the average number of 1’s and 0’s in bit arrays
Answer:- (A).
Explanations :Hamming/ population count involves finding the number of 1’s in the bit array. Population count is used in data compression.
Explanations :Hamming/ population count involves finding the number of 1’s in the bit array. Population count is used in data compression.
- Used by the Linux kernelRead
- For the allocation of memory pages
- Bloom filter
- Implementation of Vectors and Matrices
Answer:- (D).
Explanations :Normal Arrays are used to implement vectors and matrices. Bit arrays have no prominent role. Remaining all are applications of Bit Arrays.
Explanations :Normal Arrays are used to implement vectors and matrices. Bit arrays have no prominent role. Remaining all are applications of Bit Arrays.
- Arrays sorted in numerical order
- Arrays sorted in alphabetical order
- Elements of the array are placed at equally spaced addresses in the memory
- All of the mentioned
Answer:- (D).
Explanations :The array can be sorted in any way, numerical, alphabetical or any other way but the elements are placed at equally spaced addresses.
Explanations :The array can be sorted in any way, numerical, alphabetical or any other way but the elements are placed at equally spaced addresses.
Copyright © 2022 Shineskill Software Pvt. Ltd., All rights reserved.