SQA Higher Computing Science Practice Exam

Access More Questions
Which type of value can only be true or false?
Correct Answer:
Boolean
Explanation:
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 SAMPLEof binary logic.

Access more questions from this quiz

Continue to SQA Higher Computing Science Practice Exam for more practice questions and the full quiz experience.

Access More Questions