1 / 23

Data Representation and Storage

Data Representation and Storage. Lecture 5. Representations. A number value can be represented in many ways: 5 Five V IIIII Cinq Hold up my hand. Binary Numbers. In the binary number system, all values are represented using only the two binary digits 0 and 1

alban
Download Presentation

Data Representation and Storage

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Representation and Storage Lecture 5

  2. Representations A number value can be represented in many ways: • 5 • Five • V • IIIII • Cinq • Hold up my hand

  3. Binary Numbers • In the binary number system, all values are represented using only the two binary digits 0 and 1 • “bit” is a contraction of “binary digit”

  4. Binary Numbers 1-bit numbers can represent 2=21 different numbers • 0 - 0 • 1 – 1 2-bit numbers can represent 4=22 different numbers • 00 - 0 • 01 - 1 • 10 - 2 • 11 - 3

  5. Binary Numbers 3-bit numbers can represent 8=23 different numbers • 000 - 0 • 001 - 1 • 010 - 2 • 011 - 3 • 100 - 4 • 101 - 5 • 110 - 6 • 111 - 7

  6. Decimal Numbers • Place system 123 = 1x100 + 2x10 + 3x1 = 1x102 + 2x101+ 3x100

  7. Binary representation • Subscript tells you which representation • Put little powers of 2 on top of column

  8. Converting binary to decimal • The second line has an error • You do some (using little powers of 2 on top)

  9. Representing Integers • When an integer value must be saved on a computer, its binary equivalent can be encoded as a bit pattern and stored digitally. • Usually, a fixed size (e.g., 32 bits) is used for each integer so that the computer knows where one integer ends and another begins.

  10. Characters • Characters have no natural correspondence to binary numbers • Computer scientists devised an arbitrary system for representing characters as bit patterns. • ASCII (American Standard Code for Information Interchange) maps each character to a specific bit pattern.

  11. ASCII

  12. Bit • A bit is the smallest unit of memory in the computer. • It can take the value 1 or 0. • All data in a computer is represented as a pattern of bits.

  13. Byte • A group of 8 bits is called a byte. • Since each bit can be either 0 or 1, there are 256 different bit patterns that can be represented using 8 bits. • A nybble is 4 bits.

  14. Unicode • An extension of ASCII • A 16-bit character encoding scheme. • Uses 2 bytes for each character • Allows more characters from major world languages to be encoded.

  15. ASCII file • A document that contains plain text only (such as a Notepad file – even html) is called an ASCII file or a text file. Each character of text is stored as one ASCII pattern, in one byte of memory. So a file containing 20 lines of text, with 100 characters per line, would be stored in 2000 bytes.

  16. SIZE • The size of a file = number of bytes stored in the file. • For ASCII text files, the size of the file = number of characters.

  17. SIZE • 1KB = 1 Kilobyte = 1,024 bytes = 210 bytes (a page of 20 lines of text, about 100 chars per line, would be about 2 KB) • 1MB = 1 Megabyte = 1,024 KB = 220 bytes (about 1,000 pages of text would be about 2MB) • 1GB = 1 Gigabyte = 1,024 MB = 230 bytes

  18. Binary files • Computers are capable of representing much more than numbers and text. • If you try to open a Word document in Notepad, sometimes you see garbage characters because those bytes don't correspond to ASCII codes.

  19. Binary Files • Files that contain anything except plain text (e.g. formatted Word documents, executable program files or pictures) are not stored as ASCII files. • But the information is still stored in a type of binary format. They are called binary files.

  20. Graphics • "A picture is worth 1,000 words" - Actually, computer scientists would say that it is worth more! 1,000 words, at an average of 5 chars per word = 5,000 chars = about 5KB. That's enough for a very, very tiny picture. Most graphics on the web are over 30KB! • high-resolution vs. low-resolution -> tradeoff of image quality vs. storage space

  21. Compression • Graphics (picture), music and video files are very large. • File compression techniques are used to reduce the storage requirements for large files

  22. Speed of data transmission • Data is transmitted at speeds that are measured in terms of bps- bits per second. • The time it takes to download a file depends on the size of the file and the speed of the transmission. Compression reduces file size and thus the time it takes to transmit. • Waterpipe analogy- empty tank

  23. Speed of data transmission When you connect to the Internet: • Modem (define ?) - 28.8Kbps, 56Kbps • Faster means such as • Cable modem- uses part of the capacity of the local cable system to transmit data • DSL (Digital Subscriber Line) -a technology that allows high speed data transmission over telephone lines.

More Related