In C++, bool data type is used to hold how many values?

20212021

In C++, bool data type is used to hold how many values?

  1. A.

  2. B.

    2

  3. C.

    2n

  4. D.

    2n

Attempted by 314 students.

Show answer & explanation

Correct answer: B

In C++, the bool data type is used to store only two possible values:

  • true

  • false

Since it can hold only these two values, the correct answer is 2.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs