Binary, Hexadecimal, and Programming Language Concepts Guide
----------------------------------------
1. Binary to Decimal and Octal Conversions
----------------------------------------
Use 3-bit grouping and the truth table to convert binary to octal.
Binary: 01001110100101001
= Group: 000 100 111 010 010 100 1 Pad: 00001001110100101001
= Decimal: 16041
= Octal: 047245
Binary: 0100111010010110
= Group: 000 100 111 010 010 110 Pad: 0000100111010010110
= Decimal: 20118
= Octal: 047246
Binary: 100100101110110101
= Group: 100 100 101 110 110 101
= Decimal: 301877
= Octal: 445655
----------------------------------------
2. 3-Bit Truth Table (Binary to Decimal and Octal)
----------------------------------------
| Binary | Decimal | Octal |
|--------|---------|-------|
| 000 |0 |0 |
| 001 |1 |1 |
| 010 |2 |2 |
| 011 |3 |3 |
| 100 |4 |4 |
| 101 |5 |5 |
| 110 |6 |6 |
| 111 |7 |7 |
----------------------------------------
3. 3-Bit and 4-Bit Integer Truth Tables
----------------------------------------
3-Bit:
| A | B | C | Binary | Decimal |
|---|---|---|--------|---------|
| 0 | 0 | 0 | 000 |0 |
| 0 | 0 | 1 | 001 |1 |
| 0 | 1 | 0 | 010 |2 |
| 0 | 1 | 1 | 011 |3 |
| 1 | 0 | 0 | 100 |4 |
| 1 | 0 | 1 | 101 |5 |
| 1 | 1 | 0 | 110 |6 |
| 1 | 1 | 1 | 111 |7 |
4-Bit:
| A | B | C | D | Binary | Decimal |
|---|---|---|---|--------|---------|
| 0 | 0 | 0 | 0 | 0000 | 0 |
| 0 | 0 | 0 | 1 | 0001 | 1 |
| 0 | 0 | 1 | 0 | 0010 | 2 |
| 0 | 0 | 1 | 1 | 0011 | 3 |
| 0 | 1 | 0 | 0 | 0100 | 4 |
| 0 | 1 | 0 | 1 | 0101 | 5 |
| 0 | 1 | 1 | 0 | 0110 | 6 |
| 0 | 1 | 1 | 1 | 0111 | 7 |
| 1 | 0 | 0 | 0 | 1000 | 8 |
| 1 | 0 | 0 | 1 | 1001 | 9 |
| 1 | 0 | 1 | 0 | 1010 | 10 |
| 1 | 0 | 1 | 1 | 1011 | 11 |
| 1 | 1 | 0 | 0 | 1100 | 12 |
| 1 | 1 | 0 | 1 | 1101 | 13 |
| 1 | 1 | 1 | 0 | 1110 | 14 |
| 1 | 1 | 1 | 1 | 1111 | 15 |
----------------------------------------
4. Programming Language Definitions
----------------------------------------
Assembly Language:
A low-level language using symbolic mnemonics that maps closely to machine instructions.
Low-Level Language:
Languages close to machine hardware like Assembly and Machine Language. Fast but complex.
Machine Language:
Binary code (0s and 1s) directly executed by the CPU.
High-Level Language:
Easy-to-read, English-like code (e.g., Python, C++) that must be compiled/interpreted.
----------------------------------------
5. Selection vs. Iteration Statements
----------------------------------------
| Feature | Selection Statement | Iteration Statement |
|------------------|-----------------------------|------------------------------|
| Purpose | Chooses a path | Repeats code |
| Examples | if, if-else, switch | for, while, do-while |
| Control Flow | Branching | Looping |
| Based On | Condition | Loop condition |
----------------------------------------
6. Hexadecimal to Decimal Conversion
----------------------------------------
1. 1ADEF6 = 1×16^5 + 10×16^4 + 13×16^3 + 14×16^2 + 15×16^1 + 6×16^0 = 1,286,014
2. 1A6DFEE = 1×16^6 + 10×16^5 + 6×16^4 + 13×16^3 + 15×16^2 + 14×16^1 + 14×16^0 = 27,639,518
3. 4ADEDF9 = 4×16^6 + 10×16^5 + 13×16^4 + 14×16^3 + 13×16^2 + 15×16^1 + 9×16^0 = 78,926,513