DOC PREVIEW
CUNY CISC 1001 - Data Representation

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN 0-13-046709-XAnalog vs. DigitalBinary NumbersDecimal  BinaryThe 16 Hex DigitsHex (0-9,A-F)Representing IntegersRepresenting Real NumbersRepresenting CharactersRepresenting TextSlide 11Slide 12Slide 13Binary - HEX – BinaryDigitizing SoundSlide 16SamplingRepresenting SoundsRepresenting Sounds (cont.)Slide 20How Many Bits per Sample?Slide 22Advantages of Digital SoundRepresenting ImagesRepresenting Images (cont.)Distinguishing Data TypesSlide 271A Balanced Introduction to Computer ScienceDavid Reed, Creighton University©2005 Pearson Prentice HallISBN 0-13-046709-XChapter 12Data Representation2Analog vs. Digitalthere are two ways data can be stored electronically 1. analog signals represent data in a way that is analogous to real life signals can vary continuously across an infinite range of values e.g., frequencies on an old-fashioned radio with a dial2. digital signals utilize only a finite set of values e.g., frequencies on a modern radio with digital display)the major tradeoff between analog and digital is variability vs. reproducibilityanalog allows for a (potentially) infinite number of unique signals, but they are harder to reproducegood for storing data that is highly variable but does not need to be reproduced exactlydigital signals limit the number of representable signals, but they are easily remembered and reproducedgood for storing data when reproducibility is paramount3Binary Numbersmodern computers save and manipulate data as discrete (digital) valuesthe most effective systems use two distinct binary states for data representationin essence, all data is stored as binary numbersin the binary number system, all values are represented using only the two binary digits 0 and 1, which are called bitsbinary representationconverting binary to decimal4Decimal  Binaryalgorithm for converting from decimal (D) to binary (B):8-5The 16 Hex Digits0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,FA = 10, B = 11, ... , F = 15Sixteen values can be represented perfectly by 4-bit sequences (24 = 16)Changing hex digits to bits and back again:Given a sequence of bits, group them in 4's and write the corresponding hex digit0101 11005 CGiven hex, write the associated group of 4 bits8-6Hex (0-9,A-F) Decimal Hex Binary 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0100 7 7 0111 8 8 1000 9 9 100110 A 101011 B 101112 C 110013 D 110114 E 111015 F 11117Representing Integerswhen an integer value must be saved on a computer, its binary equivalent can be encoded as a bit pattern and stored digitallyusually, a fixed size (e.g., 32 bits) is used for each integer so that the computer knows where one integer ends and another beginsthe initial bit in each pattern acts as the sign bit (0=positive, 1=negative)negative numbers are represented in two’s complement notation the "largest" bit pattern corresponds to the smallest absolute value (-1)8Representing Real Numbersa real number can be uniquely identified by the two components of its scientific notation (fractional part and the exponent)123.45 = 12345 x 10-2.000042 = 42 x 106thus, any real number can be stored as a pair of integersreal numbers stored in this format are known as floating point numbers, since the decimal point moves (floats) to normalize the fractionstandard formats exist for storing real numbers, using either 32 bits (single precision) or 64 bits (double precision)most programming languages represent integers and reals differently JavaScript simplifies things by using IEEE double-precision floating point for all numbers9Representing Characterscharacters 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 8-bit patternnote that all digits are contiguous, as are all lower-case and all upper-case letters'0' < '1' < … < '9''A' < 'B' < … < 'Z''a' < 'b' < … < 'z'10Representing Textstrings can be represented as sequences of ASCII codes, one for each character in the stringspecific programs may store additional information along with the ASCII codese.g. programming languages will often store the number of characters along with the ASCII codese.g., word processing programs will insert special character symbols to denote formatting (analogous to HTML tags in a Web page)11Representing TextThe size of a file = number of bytes stored in the file. For plain ASCII text files, the size of the file = number of characters. Word processing documents are larger because of the extra formatting information that is part of the file. 1KB (kilobyte) = 210 bytes = 1024 bytes (a file of 20 lines of text, about 100 chars per line, would be about 2 KB) 1MB (megabyte) = 220 bytes = 1024KB (about 1,000 pages of text, each page 20 lines of 100 chars, would be about 2MB) 1GB (gigabyte) = 230 bytes = 1024MB1TB (terabyte) = 240 bytes = 1024GBSpeed of Data Transmission:Data are transmitted at speeds measured in bps (bits per second).Typical Speeds:Modem - 33.6Kbps, 56KbpsISDN - 64Kbps, DSL - 768Kbps – 3MbsCable Modem - > 3Mbs8-12The 16 Hex Digits0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,FA = 10, B = 11, ... , F = 15Sixteen values can be represented perfectly by 4-bit sequences (24 = 16)Changing hex digits to bits and back again:Given a sequence of bits, group them in 4's and write the corresponding hex digit0101 11005 C8-13Hex (0-9,A-F) Decimal Hex Binary 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 100110 A 101011 B 101112 C 110013 D 110114 E 111015 F 1111Binary - HEX – Binary •Example:(0100001010100101011011110001)2 = (?)160100 0010 1010 0101 0110 1111 0001= (4 2 A 5 6 F 1)16Example:(AF52C)16 = (?)2A F 5 2 C= (1010 1111 0101 0010 1100)21411-15Digitizing SoundAn object creates sound by vibrating in a medium such as airVibrations push the airPressure waves emanate from the object and vibrate our eardrumsThe force, or intensity of the push determines the volumeThe frequency (number of waves per second) is the pitch11-16Analog Sound11-17SamplingTake measurements at


View Full Document

CUNY CISC 1001 - Data Representation

Download Data Representation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Data Representation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Data Representation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?