
Understanding Bits, Bytes, and Digital Information in Computer Science
Explore the concepts of analogue vs. digital information, conversion between decimal and binary numbers, encoding visual and sound information, and the fundamentals of decimal and binary number systems. Learn how computers store and process data using numbers in various forms.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Bits, bytes and digital information Lecture 2 COMPSCI111/111G SS 2017
Todays lecture Understand the difference between analogue and digital information Convert between decimal numbers and binary numbers
Analogue vs digital information Information in the real world is continuous Continuous signal Weight shown Real Weight Information stored by a computer is digital Represented by discrete numbers Weight shown Real Weight
Encoding information Real world information is stored by a computer using numbers Visual information 11111111111111111111111 01111111111111111111111 00001111111111111111111 00000011111111111111111 00000000011111111111111 44444000001111111111111 75444000000011111111111 55554401000000111111111 33367544000000011111111 22283554444000000111111 99928357544000000011111 99999233657504000001111 99999983666554400000011 99999928338674400000001 Image Pixels 1. Give each pixel colour a number. 2. Let the computer draw the numbers as coloured pixels (eg. black = 0).
Encoding information Sound information Sound Waveform Samples 1. Give each sample a number (height of green box). 2. Let the computer move the loudspeaker membrane according to the samples.
Decimal numbers The decimal number system is a base 10 system You can think about it as a dial with 10 positions: 600 + 30 + 8 = 638
Decimal numbers The number of dials corresponds to the numbers that can be generated So: Possible numbers = 10n Range = 0 to 10n-1 For example, if we have four dials Therefore: 104 = 10,000 possible numbers Note 10 = base 10 and 4 = number of dials Range = 0 to 9999 (ie. 0 to 104-1)
Binary numbers A number whose value is either 0 or 1 It s too complex to create 10 states in electronic circuitry. Much easier if we have two states like a switch, ON and OFF This is how binary numbers work; 0 usually means OFF and 1 usually means ON 0 1
Binary numbers Each binary number is called a bit (binary digit) Using strings of bits, we can represent any whole number Using one switch (ie. one bit) we can represent up to two numbers (ie. 0 and 1)
Binary numbers Using two switches (ie. two bits) we can generate up to four numbers Decimal 0 Binary 00 1 01 10 2 3 11
Binary numbers So: Possible numbers = 2n Range = 0 to 2n-1 For example, if we have four switches Therefore: 24 = 16 possible numbers Note 2 = base 2 and 4 = number of switches Range = 0 to 24-1: 00002 to 11112 010 to 1510
Converting binary to decimal With decimal numbers, each dial s position has a value: 1 * 103 + 5 * 102 + 2 * 101 + 1 * 100 1000 + 500 + 20 + 1 = 152110 Similarly with binary numbers, each switch s position has a value. Convert 11012 to decimal: 1 * 23 + 1 * 22 + 0 * 21 + 1 * 20 1 * 8 + 1 * 4 + 0 * 2 + 1 * 1 = 1310
Converting binary to decimal Convert 100112 to decimal Convert 3510 to binary
Prefixes A group of 8 bits is a byte A group of 4 bits is a nibble Bytes are the common unit of measurement for memory capacity There are two sets of prefixes: Decimal Binary
Decimal prefixes 10n Prefix Symbol Decimal 1 none 1 103 kilo K 1000 106 mega M 1,000,000 109 giga G 1,000,000,000 1012 tera T 1,000,000,000,000 1015 peta P 1,000,000,000,000,000 1018 exa E 1,000,000,000,000,000,000 1021 zetta Z 1,000,000,000,000,000,000,000
Binary prefixes 2n Prefix Symbol Decimal 20 none 1 210 kibi Ki 1024 220 mebi Mi 1,048,576 230 gibi Gi 1,073,741,824 240 tebi Ti 1,099,511,627,776 250 pebi Pi 1,125,899,906,842,624 260 exbi Ei 1,152,921,504,606,846,976 270 zebi Zi 1,180,591,620,717,411,303,424
Prefixes in Computer Science Both decimal and binary prefixes are used in Computer Science Decimal prefixes are preferred because they are easier to calculate, however binary prefixes are more accurate Binary prefix Decimal prefix Value (bytes) 8 bits 1 byte same 1 KiB (1 x 210 bytes) 1 KB 1024 1000 (1 x 103 bytes) 1 MiB (1 x 220 bytes) 1 MB 1,048,576 1,000,000 (1 x 106 bytes)
Example hard disk sizes A 160GB hard disk is equivalent to 149.01GiB 160GB = 160 x 109 149.01GiB = (160 x 109) 230
Questions Which has more bytes, 1KB or 1KiB? How many bytes are in 128MB? Convert 8810 to binary Convert 1110012 to decimal
Answers Which has more bytes, 1KB or 1KiB? 1KB = 1000 bytes while 1KiB = 1024 bytes How many bytes are in 128MB? 128 x 106 = 128,000,000 bytes Convert 8810 to binary 10110002 Convert 1110012 to decimal 5710
Summary Computers use the binary number system We can convert numbers between decimal and binary Decimal prefixes and binary prefixes are used for counting large numbers of bytes