Which One Is a Valid Declaration of a Boolean?

The correct valid declaration is boolean b1 = false.

Which one is a valid declaration of boolean Mcq?

Answer: C. A boolean can only be assigned the literal true or false.

Which is the correct declaration of a Boolean variable?

To declare a Boolean variable, we use the keyword bool. To initialize or assign a true or false value to a Boolean variable, we use the keywords true and false. Boolean values are not actually stored in Boolean variables as the words “true” or “false”.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.