C++ MCQs - BitSet

This section focuses on the "BitSet" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Space taken by bitset bs is less than?

A. bool bs[N]
B. vector bs(N)
C. Both A and B
D. None of the above

View Answer


2. What is true about bitset?

A. A bitset is an array of bool 
B. A limitation of bitset is, N must be known at compile time
C. As bitset stores the same information in compressed manner the operation on bitset are faster than that of array and vector.
D. All of the above

View Answer


3. The size of bitset is fixed at compile time that is, it can’t be changed at runtime.

A. TRUE
B. FALSE
C. Can be true and false
D. Can not say

View Answer


4. Which bitset method tests whether all bits from bitset are set or not?

A. bitset::any()
B. bitset::test()
C. bitset::all()
D. bitset::operator[]

View Answer


5. Which bitset method toggles all bits from bitset?

A. bitset::count()
B. bitset::flip()
C. bitset::test()
D. bitset::to_ullong()

View Answer


6. bitset::hash() used for?

A. Convert hash value to unsigned long
B. Returns hash value based on the provided bitset.
C. Reports the size of the hash.
D. Reset hash value to zero.

View Answer


7. Which of the following is the limitation of bitset over vector bool?

A. Space
B. Size
C. Type
D. Speed

View Answer


8. Which operator is used to access the nth bit in a bitset?

A. $
B. #
C. []
D. *

View Answer


9. How many ways are there for constructing a bitset?

A. 1
B. 2
C. 3
D. 4

View Answer


10. What is the default value of a bitset?

A. 0
B. 1
C. -1
D. infinite

View Answer





Discussion


* You must be logged in to add comment.