1.2 Compare and contrast fundamental data types and their characteristics
📘CompTIA ITF+ (FC0-U61)
1. What Is a Char?
A char (short for character) is a data type used to store a single character.
A single character can be:
- A letter → A, b, Z
- A digit → 1, 3, 9
- A symbol → @, #, $
- A whitespace character → space, tab
- A control character → like newline ( \n )
Key point:
➡️ A char always stores exactly ONE character, not multiple.
2. How Is a Char Stored in a Computer?
Computers store characters as numbers, using a character encoding system.
The most common systems are:
ASCII
- Uses 7 or 8 bits.
- Can represent 128 or 256 characters.
- Supports basic English characters + symbols.
Unicode
- A universal standard.
- Supports characters for many languages and special symbols.
- Most modern systems use UTF-8 or UTF-16 encoding.
Example (IT-related):
- The letter ‘A’ in ASCII = 65
- The letter ‘a’ in ASCII = 97
So even though you see a letter, the computer stores it as a numeric code.
3. Size of a Char
The size depends on encoding:
| Encoding | Typical Size | Notes |
|---|---|---|
| ASCII | 1 byte | Older systems, English-only |
| UTF-8 | 1–4 bytes | Most common today |
| UTF-16 | 2–4 bytes | Used in some programming environments |
For ITF+, simply remember:
➡️ Chars are small data types that store one character using a code like ASCII or Unicode.
4. Char vs. String (Know for Exam)
Many students confuse char with string, so ITF+ often tests this difference.
| Feature | Char | String |
|---|---|---|
| Stores | 1 character | Multiple characters |
| Examples | ‘A’, ‘7’, ‘#’ | “Admin”, “Login123”, “GET /index.html” |
| Size | Small | Larger |
| Quotes used | Single quotes: 'A' | Double quotes: "A" |
Exam tip:
➡️ If it stores more than one character, it is not a char — it’s a string.
5. Why Is Char Important in IT?
Chars are used throughout IT systems. Here are IT-specific situations where chars matter:
a) Password validation
A password system checks each character to ensure:
- At least 1 uppercase char
- At least 1 lowercase char
- At least 1 digit
- At least 1 symbol
Each requirement uses char-level analysis.
b) Reading input from a keyboard
When you type:
- Each key press sends one char to the system.
- The login box then assembles chars into a string (your username).
c) File parsing
Log analysis tools read logs character by character:
- “E”, “R”, “R”, “O”, “R”
- Helps detect status codes, IP addresses, protocols, etc.
d) Communication protocols
Network packets often contain:
- Single-character flags
e.g., “R” for Read, “W” for Write - Delimiters like “,” or “;”
These are stored as chars.
e) Configuration files
In config or script files:
- A single missing or incorrect char (like
{or;) can break the script. - Tools check chars to validate syntax.
6. Characteristics of a Char (Exam-Focused)
Here are the main points the exam expects you to know:
✔ Single character only
A char cannot hold multiple characters.
✔ Stored as a numeric code
via ASCII or Unicode.
✔ Represented using single quotes
Most languages use:
'A'
'#'
'7'
✔ Small data size
Efficient for storing flags, symbols, digits.
✔ Often used internally in strings
Strings are made up of char sequences.
✔ Used in parsing, validation, and encoding operations
Important for IT tasks like authentication, file processing, and network data handling.
7. Common Exam Questions (What They May Ask)
You don’t need to answer these now—this is just to help you see how the exam tests this topic:
- What does the char data type store?
- How many characters does a char hold?
- What is the difference between ASCII and Unicode?
- Is ‘T’ a char or a string?
- Why is Unicode used instead of ASCII?
- Which data type should be used to store a single letter?
If you understand everything above, you will answer all of these easily.
Summary (Easy to Remember)
- Char = one character only
- Stored using ASCII or Unicode
- Uses single quotes (‘ ‘) in many languages
- Small, efficient data type
- Used in password checks, keyboard input, file parsing, network protocols
- Not the same as a string
