Computer Science
Teacher: Maruf Ahmed
Chapter 1 (Data representation)
Analog data, Digital data, Uses of Binary number and Hexadecimal number
Analog data: data values that are continuously changing. Analog data is continuous and non-discrete data.
Data such as sound wave
Digital data: Discrete (individually separate and distinct) data that has only two values. For example, binary
data which is either 1 or 0.
Why computer uses Binary numbers?
- Computers use voltages and since voltages changes often, no specific voltage is set for each number
in the decimal system. For this reason, binary is measured as a two-state system i.e., on or off. Also,
to keep calculations simple, computers use the binary number system.
- Any form of data needs to be converted to binary to be processed by a computer
- Data is processed using logic gates and stored in registers
Why data is stored as binary in computers?
- Computers use switch/logic gate which has only 2 states either ‘On’ state or ‘Off’ state and are
represented by 1 and 0 respectively.
Uses of binary number in computer:
Binary numbers are used to store:
- an address in main memory
- data
- ASCII value / Unicode value / character
- number
- part of image / small image
- a sound / sound sample / small sound track
- instruction
Why human uses Hexadecimal numbers?
- Hexadecimal numbers are used in many areas of computing to simplify binary codes.
- It is important to note that computers do not use hexadecimal - it is used by humans to shorten binary
to a more easily understandable form.
- Hexadecimal is translated into binary for computer use.
Benefits of using hexadecimal notation to represent binary values:
• Easier to read/write/understand
• Easier to remember
• Short way to represent binary // Uses less screen/display space
Page 1 of 2
• Easier to debug
• easier to find errors
• conversion from hexadecimal to binary is easier than denary to binary
• faster than binary for entering numbers
Why a programmer might prefer to read the instruction in hexadecimal rather than in binary
• Easier/quicker to understand/read
• Easier to debug/identify errors
• Fewer digits are used / shorter // takes up less space on screen // more can be shown on screen / page
Some general uses of Hexadecimal number with examples in computer:
• Used in HTML colour codes / Notations for colour in HTML
e.g., red - FF0000, green - 00FF00, blue - 0000FF
• Used in memory dump / error codes (shows the memory location of the error codes)
e.g., 5F 3A 09 F1
• Used in MAC (Media Access Control) addresses
e.g., 01-23-45-67-89-AB (in 48 bits) or 01-23-45-67-89-AB-CD-12 (in 64 bits)
• Used to represent IP addresses
e.g., B1.2A.1F.A2 (in 32 bits for IPv4 version)
e.g., [Link] AABC: [Link] (in 128 bits for IPv6 version)
• To generate error messages on the internet
e.g., error #404 page not found, error #503 Service Unavailable
• Used in Assembly language
e.g., 5F 3A 09
• Used in Machine Language
e.g., AB 2C F2
• Used as locations in memory
e.g., AA 09 F1
Page 2 of 2