AIT_CS_01
AIT_CS_01
Computer Science
Fall 2024
1
Introduction
2
Some History
3
Some History
4
Layers of Computing
5
Course Perspective
6
Binary
7
Base Definitions
○ The rightmost digit always represents 1 (b0), and it increases as we read left
3 5 1 3 5 1
In base 10, this numeral means we have 3 100s, In base 6, this numeral means we have 3 36s, 5
5 10s, and a 1. 6s, and a 1.
8
Binary
● Humans think about numbers in base 10, but computers “think” about numbers in base 2
(binary)
9
Why Binary?
10
Binary and Hex
● Binary is inconvenient for humans, so computer scientists often write numbers in base
16 (hexadecimal)
○ 16 digits: 0-9, A-F
○ Why hex?
■ Easy conversion, each hex digit = 4 bits!
● 2 hex digits = 1 byte
● We use prefixes to denote common bases
○ 0b = binary
○ 0x = hex
○ No prefix = decimal
11
Base 10 Base 2 Base 16
● binary -> hex: break into groups of 4 bits from right 6 0110 6
7 0111 7
to left, add leading 0s if necessary, then translate 8 1000 8
○ Ex: 0b101101 = 0b0010 1101 = 0x2D
9 1001 9
● Note: does not work for decimal conversions! 10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
12
Review Questions: Binary, Hex, and Decimal
13
Numerical Encoding
14
So What’s it Mean?
15
Binary Encoding Example - Colors
16
Binary Encoding Example - Text
17
Binary Encoding Example - Files and Programs
● At the lowest level, all digital data is stored as bits!
● Layers of abstraction keep everything comprehensible to humans
○ Data/files are groups of bits interpreted by a program
○ Program is also a sequence of bits interpreted by the CPU
18
Summary
● All computer data is stored in binary
○ Humans think in decimal, have to convert between bases
○ Hex as a more human-readable base that’s easy to convert
● Binary can represent anything!
○ Program needs to know how to interpret the bits
19