Which type of value can only be true or false?

Study for the SQA Higher Computing Science Exam with flashcards and multiple choice questions. Each question offers hints and explanations. Prepare effectively for your exam!

The type of value that can only be true or false is a Boolean. In programming and computer science, Boolean values represent the binary state of logic: true or false. This binary nature is fundamental in conditions, decision-making, and logical operations within algorithms and code.

On the other hand, integer, string, and float types can represent a wide range of values that go beyond just true or false. Integers are whole numbers (e.g., -1, 0, 1, 2), strings represent sequences of characters (e.g., "hello", "123"), and floats are decimal numbers (e.g., 3.14, -0.001). Each of these types holds a different kind of information, making them unsuitable for solely representing truth values. Thus, the Boolean type is uniquely defined to provide a straightforward representation of binary logic.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy