A programmer is writing a script and needs to store a single letter of the alphabet in a variable. Which of the following fundamental data types is the most appropriate for this task?
The correct answer is 'Char'. The 'Char' data type is specifically designed to store a single character, such as a letter or symbol. 'String' is used for a sequence of characters. 'Integer' and 'Float' are numeric types for whole numbers and decimal numbers, respectively, and are not suitable for storing a character.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the main purpose of the 'char' data type?
Open an interactive chat with Bash
How is 'char' different from a 'string' data type?
Open an interactive chat with Bash
In what situations would you use a 'char' instead of a 'string'?