1.

Which of the following is correct about bitset and vector of bools?(a) Space consumed by bitset is less than vector(b) Bitset consume only 1 bit per element(c) Number of elements in bitset should be known at compile time whereas vector can have a dynamic size(d) All of the mentionedI have been asked this question in quiz.The origin of the question is Bitset in section Class Hierarchies, Library & Containers of C++

Answer»

The correct option is (d) All of the mentioned

Explanation: Bitset consumes less space COMPARED to BOOL vector HOWEVER the size for bitset is static WHEREAS for bool vector size is dynamic.



Discussion

No Comment Found

Related InterviewSolutions