

MCQOPTIONS
Saved Bookmarks
This section includes 13 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
What does size() function returns? |
A. | To count the number of 0's |
B. | To count the number of 1's |
C. | To count the number of total bits used by bitset variable |
D. | To count the number of low bits |
Answer» D. To count the number of low bits | |
2. |
What is the use of count() function in bitset? |
A. | To count the number of 0's |
B. | To count the number of 1's |
C. | To count the number of total bits in a bitset |
D. | To count the number of low bits |
Answer» C. To count the number of total bits in a bitset | |
3. |
Indexing of bitset variables starts from ___________ |
A. | leftmost bit |
B. | rightmost bit |
C. | same as in an array |
D. | front |
Answer» C. same as in an array | |
4. |
Which header file is required for using bitset in your program? |
A. | <bit> |
B. | <bitset> |
C. | <bits> |
D. | <BitSet> |
Answer» C. <bits> | |
5. |
What is the default value of a bitset? |
A. | All bits are 0 |
B. | All bits are 1 |
C. | Leftmost bit is 0 |
D. | Rightmost bit is 0 |
Answer» B. All bits are 1 | |
6. |
Which of the following is corect way of constructing bitset using binary string? |
A. | bitset<size> b; |
B. | bitset<size> b(12); |
C. | bitset<size> b(string( 1100 )); |
D. | bitset<size> b(float(12)); |
Answer» D. bitset<size> b(float(12)); | |
7. |
Which of the following is corect way of constructing bitset using integer number? |
A. | bitset<size> b; |
B. | bitset<size> b(12); |
C. | bitset<size> b(string( 1100 )); |
D. | bitset<size> b(float(12)); |
Answer» C. bitset<size> b(string( 1100 )); | |
8. |
Which is the correct syntax of constructing a bitset? |
A. | bitset<size> b; |
B. | bitset<size> b(12); |
C. | bitset<size> b(string( 1100 )); |
D. | all of the mentioned |
Answer» E. | |
9. |
How many ways are there for constructing a bitset? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» D. 4 | |
10. |
Which operator is used to access the nth bit in a bitset? |
A. | -> |
B. | [] |
C. | . |
D. | * |
Answer» C. . | |
11. |
Which of the following is the limitation of bitset over vector bool? |
A. | Space |
B. | Size |
C. | Type |
D. | Speed |
Answer» C. Type | |
12. |
Which of the following is correct about bitset and vector of bools? |
A. | Space consumed by bitset is less than vector<bool> |
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 mentioned |
Answer» E. | |
13. |
What is bitset in C++? |
A. | An array of bools consuming one bit per element |
B. | Vector of bools |
C. | C-like arrays of bool elements |
D. | Template class |
Answer» B. Vector of bools | |