❓ Q. Computers only understand binary — so how do they handle numbers like 2 or 3?
✅ A. All data and instructions are converted into binary (0s and 1s).
The smallest unit of data in a computer is called a bit, which can be either 0 or 1.
🔸 How to represent negative numbers in binary?
We use two’s complement, a system that allows binary numbers to store both positive and negative values.
✅ Two conditions for two’s complement:
EX) For 8 bits -> range is −128 to +127
✏️ Example: Represent −11 in 8-bit two’s complement
Start with +11 in binary:
+11 = 00001011
🔟 Hexadecimal
❓ Q. If computers only understand binary, why do we use hexadecimal?
✅ A. Hexadecimal (base-16) is a human-friendly way to write binary.
Each hex digit = 4 binary bits, so it's easy to convert between the two.
📚 Character Set
A character set is a collection of characters that can be encoded into binary and decoded back into characters.
🔁 Encoding & Decoding
Encoding: The process of converting characters into binary
Decoding: The process of converting binary back into characters
🔢 ASCII Code
ASCII Code is the numeric value assigned to each ASCII character.
The result of encoding is binary, but it's based on the ASCII code (a number).
Example: 'A' → ASCII code 65 → Binary 01000001
🌐 Unicode
Unicode is a universal character set that includes characters from many languages, as well as symbols, emojis, and special characters.
Unicode characters are also represented by numbers, and there are multiple encoding formats to represent them in binary:
Each format differs in how many bytes it uses and how efficiently it stores different kinds of characters.