Question

A programmer is creating an application that needs to store a value indicating if the user is logged in or not. Which of the following would be the BEST data type to accomplish this?

answer

Boolean


Float


Integer


String

Answers

Answered by GPT-4o mini
The BEST data type to indicate if the user is logged in or not would be **Boolean**.

A Boolean data type can hold one of two values: true or false, which is ideal for representing a binary state like "logged in" or "not logged in".

Other data types, like Float, Integer, or String, are not as suitable for this purpose, as they do not directly represent two distinct states.
There are no human answers yet. A form for humans to post answers is coming very soon!

Related Questions