1/3
These flashcards review which data type is best for a user’s middle initial and why alternative types (Integer, String, Boolean) are not appropriate.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the most appropriate data type for storing a user’s middle initial?
The Character (char) data type, because a middle initial is a single letter.
Why is the Integer data type inappropriate for storing a user’s middle initial?
Integers can only hold numeric values, so they cannot represent alphabetic characters like a middle initial.
Why is the String data type not the best choice for storing a user’s middle initial?
Strings are designed to hold multiple characters; using a String for just one character is inefficient compared to a Character (char).
Why is the Boolean data type not suitable for storing a user’s middle initial?
Boolean data types only store true/false values and cannot store letters or other characters.