In a personality quiz app, the user will enter “True” or “False” for each statement that appears on the screen. What is the best structure for recording their answers in the program?

(1 point)
Responses

constants
constants

Boolean variables
Boolean variables

floats
floats

integers

1 answer

For recording the user's answers of "True" or "False" in a personality quiz app, the best structure would be Boolean variables.

Boolean variables are specifically designed to hold two values, which can represent true or false states, making them the ideal choice for capturing the user's responses to each statement.

Here's a brief breakdown of the options you mentioned:

  1. Constants - These are fixed values and not appropriate for storing user input.
  2. Boolean variables - Ideal for storing "True" or "False" responses.
  3. Floats - Used for representing decimal numbers, which is not relevant here.
  4. Integers - While integers can be used (e.g., 0 for False and 1 for True), using Boolean variables is more straightforward and clear.

Therefore, the best choice is Boolean variables.