Anda di halaman 1dari 7

Chapter 3 Exercises and Answers

Answers are in blue.


For Exercises 1- 20, mark the answers true and false as follows: A. True B. False 1. Lossless compression means the data can be retrieved without losing any of the original information. A A computer represents information in an analog form. B A computer must use the binary number system to represent information. B A digital signal represents one of two values at any point in time. A Four bits can be used to represent 32 unique things. B The signed magnitude representation of numbers has two representations for !ero. A "verflow occurs when the value that we compute cannot fit into the number of bits we have allocated for the result. A #n the A$%## character set& there is no distinction made between uppercase and lowercase letters. B The 'nicode character set includes all of the characters in the A$%## character set. T (eyword encoding replaces frequently used words with a single character. T )un length encoding is very good at compressing *nglish te+t. B 12. 13. 14. 15. 16. 17. ,uffman encoding uses variable length binary strings to represent characters. A An audio signal is digiti!ed by sampling it at regular intervals. A A %- stores audio information in a binary format. A The ./3 audio format discards information that can0t be heard by humans. A An )1B value represents a color using three numeric values. A #nde+ed color increases the number of colors that can be used in an image& and thus increases the file si!e. B Bitmap& 1#F& and 2/*1 are all e+amples of raster graphics formats. A 3ector graphics represent images in terms of lines and geometric shapes. A A 4eyframe is used in temporal compression to represent the changes from one frame to another. B 2! choose the correct word for the followin" list.

2. 3. 4. 5. 6. 7.

8. 9. 10. 11.

18. 19. 20.

For Exercises 21

A. #i"ned-ma"nitude re$resentation B. %adix &. Fre'uenc( of use ). #am$lin" E. Analo" F. )i"ital 21. 22. 555555 data is a continuous representation of information. * The representation for numbers you0ve used since grade school is called 555555. A 23. #f the number base is other than base ten& we call the decimal point the 555555 point. B 24. 555555 data is a discrete representation of information. F 25. ,uffman codes are created based on the 5555555555555 of the character. % 26. An audio signal is digiti!ed by 5555 its value at regular intervals. Exercises 2*-*+ are $ro,lems or short-answer 'uestions. 27. 6hy is data compression an important topic today7 -ata compression refers to reducing the amount of space needed to store a piece of data. Although computer storage is relatively cheep& as the amount of data 4eeps increasing rapidly the cost of storage is a factor. ,owever& the most important reason for compressing data is that more and more we share data. The 6eb and its underlying networ4s have limitations on bandwidth that define the ma+imum number of bits or bytes that can be transmitted from one place to another in a fi+ed amount of time. 28. 6hat is the difference between lossless and lossy data compression7 A lossless data compression is one in which no information is lost. A lossy data compression one in which some information may be lost. 29. 6hy do computers have difficulty with analog information7 %omputers are discrete& finite machines. Analog information is continuous and infinite. Thus& computers cannot represent analog information directly8 the analog information must be converted into a digital form. 30. 31. #s a cloc4 with a sweeping second hand an analog or a digital device7 *+plain. A sweeping second hand is an analog device. The motion of the hand is continuous. 6hat does it mean to digiti!e something7 -igiti!ing is the act of brea4ing continuous information into discrete pieces so that we can represent each piece separately. 6hat is pulse code modulation7 /ulse %ode .odulation is a signal that 9umps sharply between two e+tremes. ,ow many things can be represented with: a. four bits ;< b. five bits 32 c. si+ bits <= d. seven bits ;2>

32. 33.

34.

35.

Although you have been computing simple arithmetic operations since the second grade& ta4e the following small test to confirm that you thoroughly understand operations on signed integers. *valuate the following e+pressions where 6 is ;?& @ is 2>& A is B 2C& and D is B;3. a. @ E A b. @ E 6 c. D E 6 d. A E D ; =F = =2 e. 6 B D f. @ B 6 g. A B 6 h. D A 3G ;; =< ;< 'se the base ten number line to prove the solutions to the following operations& where A is F and B is B?. a. A E B b. A B B c. B E A d. B A

-8 -7 -6 -5 -4 -3 -2 -1

9 10 11

12 13

a. F E H ?I J 2: A is plus F. To add a ?& you move ? units to the left from the point of A& landing on 2. b. F H ?I J ;2: A is plus F. To subtract ?& you change the sign of B H?I and move B units to the right from the point of A& landing on ;2. c. ? E F J 2: B is minus ?. To add F& you move F units to the right from the point of B& landing on 2. d. ? HFI J ;2: B is minus ?. To subtract F& you change the sign and move F units to the left& landing on ;2. 36. 1iven a fi+ed si!ed number scheme where 4 in the formula for the ten0s complement is < Hsee page FCI& answer the following questions. a. ,ow many positive integers can be represented7 =CC&CCC b. ,ow many negative integers can be represented7 FGG&GGG c. -raw the number line showing the three smallest and largest positive numbers& the three smallest and largest negative numbers& and !ero.
500000 500001 500002 ... 999997 999998 999999 -500000 -499999 -499998 ...- 3 - 2 - 1 0 0 1 1 2 2 3 ... 499997 499998 499999 3 ... 499997 499998 499999

37.

38.

39.

'se the number line in *+ercise =G to calculate the following e+pressions& where A is B=CCCCC and B is 3. a. A E B b. A B B c. B E A d. B A a. =CCCCC is FGGGG;8 move three units to the right& landing on FGGGG=& which is =CCCC<. b. =CCCCC is FGGGG;8 move three units to the left& landing outside the range of numbers that can be represented. c. E 3 is 3 on the line. =CCCCC is FGGGG;8 move FGGGG; units to the left& landing on FGGGG=& which is =CCCC<. d. E 3 is 3 on the line. =CCCCC is FGGGG;8 move FGGGG; units to the right& which is outside the range of numbers that can be represented. 'se the formula for the ten0s complement to calculate the following numbers in the scheme described on page FC. a. 3F?<> b. B3F?<> c. B====FF d. B;23=F< a. 3F?<> b. C<=232 c. FFFF=F d. >?<F== #n calculating the ten0s complement in *+ercise =2& did you have trouble borrowing from so many !eros7 $uch calculations are error prone. There is a tric4 that you can use that ma4es the calculation easier and thus less prone to errors: $ubtract from all C0s and then add ;. A number subtracted from all C0s is called the nine0s complement of the number. a. /rove that the nine0s complement of a number plus one is equal to the ten0s complement of the same number.

40.

41.

42.

43.

KegativeH#I J ;G4 # in ;G0s compliment KegativeH#I J HCC..CC #I E ; in C0s compliment. HCC..CCI J H;G4 ;I KegativeH#I J H;G4 ;I # E ; J ;G4 # b. 'se the nine0s complement plus one to calculate the values in *+ercise ;2 b& c& and d. b. C<=232 c. FFFF=F d. >?<F== c. 6hich did you find easier to use& the direct calculation of the ten0s complement or the nine0s complement plus one7 2ustify your answer. This is an individual answer. *valuate the following e+pressions& where A is ;;;;;;;G and B is GGGGGG;G using two a. A E B b. A B B c. B B A d. BB e. B H AI a. GGGGGGGG b. ;;;;;;GG c. GGGGG;GG d. ;;;;;;;G e. ;;;;;;;G #s the two0s complement of a number always a negative number7 *+plain. The two0s complement is a way or representing fi+ed si!ed numbers in memory. The two0s complement of a number @ is 9ust @ in two0s complement representation. #f @ is a positive number& the two0s complement of @ is negative& but if @ is negative& the two0s complement is a positive number. ,ow is a real value stored in the computer7 Any real value can be described by three properties: the sign Hpositive or negative oneI& the digits in the value with the radi+ point assumed to be to the right& and the e+ponent& which determines how the radi+ point is shifted relative to the mantissa. A real number is represented in the computer by storing it as an integer along with information showing where the radi+ point is. %onvert the rules for subtraction in a sign magnitude system to the algorithm format. Find the first number on the number line IF addition Move in the sign direction of second number the specified units ELSE Move in the opposite sign direction of the second number the specified units %onvert the following real numbers to binary HF binary placesI. a. G.FG G.;GGGG b. G.2F G.G;GGG c. G.;G G.GGG;; %onvert the following real numbers to octal HF octal placesI. a. G.FG G.=GGGG b G.2< G.2GGGG c. G.;G G.G<3;= %an fractional values be visually converted between octal and binary and bac47 *+plain. 6hole numbers e+pressed in binary and octal can be converted visually& moving from the radi+ point to the left. Fractional values can be read of visually moving from the radi+ point to the right. ,ow many bits would be needed to represent a character set containing =F characters7 6hy7 < bits. <3 distinct things can be represented in < bits8 3; distinct things can be represented in F bits. Therefore < bits must be used. ,ow can the decimal number ;?F.23 be represented as a sign& mantissa& and e+ponent7 ;?F.23 J ;?F23 L ;G 2 6hat is the main difference between the A$%## and 'nicode character sets7 The A$%## character set uses > bits to represent a character8 the 'nicode character set does not specify a fi+ed number of bits& but the most used encoding for 'nicode does use ;< bits to represent a character. Thus while A$%## can represent 2F< characters this mapping of 'nicode can represent over <FGGG characters. A$%## is fine for representing *nglish& but the designers of

44.

45.

46.

47.

48. 49.

50.

'nicode wanted it to be able to represent all the world0s characters. A$%## is a subset of 'nicode. %reate a 4eyword encoding table that contains a few simple words. )ewrite a paragraph of your choosing using this encoding scheme. %ompute the compression ratio you achieve. "riginal te+t: %omputers are multimedia devices that manipulate data varying in form from numbers to graphics to video. Because a computer can only manipulate binary values& all forms of data must be represented in binary form. -ata is classified as being continuous HanalogI or discrete HdigitalI. -ecimal values are represented by their binary equivalent& using one of several techniques for representing negative numbers& such a sign magnitude or two0s compliment. )eal numbers are represented by a triple made up of the sign& the digits in the number& and an e+ponent that specifies the radi+ point. A character set is a list of alphanumeric characters and the codes that represent each one. The most common character set is 'nicode H;< bits for each characterI& which has A$%## as a subset. The > bit A$%## set is sufficient for *nglish but not for other Hor multipleI languages. There are various ways for compressing te+t so that it ta4es less space to store it or less time to transmit it from one machine to another. Audio information is represented as digiti!ed sound waves. %olor is represented by three values that represent the contribution of each of red& blue& and green. There are two basic techniques for representing pictures& bitmaps and vector graphics. 3ideo is bro4en up into a series of still images& each of which is represented as a picture. $ubstitutions: and: & to: > the: ~ an: ! it: < is: = character: # ASCII: % that: $ represented: @ Te+t with substitutions %omputers are multimedia devices M manipulate data varying in form from numbers N graphics N video. Because a computer can only manipulate binary values& all forms of data must be O in binary form. -ata J classified as being continuous HanalogI or discrete HdigitalI. -ecimal values are O by their binary equivalent& using one of several techniques for representing negative numbers& such a sign magnitude or one0s compliment. )eal numbers are O by a triple made up of P sign& P digits in P number& Q R e+ponent M specifies P radi+ point. A S set J a list of alphanumeric Ss Q P codes M represent each one. P most common S set J 'nicode H;< bits for each SI& which has T as a subset. P > bit T set UVJ sufficient for *nglish but not for other Hor multipleI languages. There are various ways for compressing te+t so M U ta4es less space N store U or less time N transmit U from one machine N another. Audio information J O as digiti!ed sound waves. %olor J O by three values M represent P contribution of each of red& blue& Q green. There are two basic techniques for representing pictures& bitmaps Q vector graphics. 3ideo J bro4en up into a series of still images& each of which J O as a picture. %ompression ratio: .>><=

51.

,ow would the following string of characters be represented using run length encoding7 6hat is the compression ratio7 AAAABBB%%%%%%%%---- hi there *********FF LA=BBBL%>L-= hi there L*CFF %ompression ratio is .<F>

52. 53.

6hat does code L@FLAC represent using run length encoding7 @@@@@AAAAAAAAA 1iven the following ,uffman encoding table& decipher the bit strings below. -uffman &ode &haracter 00 A 11 * 010 T 0110 % 0111 L 1000 $ 1011 ) 10010 " 10011 # 101000 K 101001 F 101010 , 101011 a. 1101110001011 a. *LAT* b. 0110101010100101011111000 b. %,")*$ c. 10100100101000010001000010100110110 c. FAKTA$T#% d. 10100010010101000100011101000100011 d. K"K$*K$* ,ow do humans perceive sound7 6e perceive sound when a series of air compressions vibrate a membrane in our ear& which sends signals to our brain. #s a stereo spea4er an analog or a digital device7 *+plain. A stereo spea4er is an analog device because it receives an analog representation of the sound wave from the stereo. The spea4er receives the signal and causes a membrane to vibrate& which in turn vibrates the air Hcreating a sound waveI& which in turn vibrates your eardrum. 6hat is an )1B value7 )1B stands for )ed& 1reen& and Blue. The )1B value is actually three numbers that indicate the relative contribution of each of these three colors. 6hat does color depth indicate7 %olor depth is the amount of data used to represent a color8 that is the number of bits used to represent each of the colors in the )1B value. ,ow does pi+el resolution affect the visual impact of an image7 #f enough pi+els are used Hhigh resolutionI and presented in the proper order side by side& the human eye can be fooled into thin4ing itWs viewing a continuous picture. *+plain temporal video compression. Temporal video compression uses the differences between frames as the basis for compression. A 4ey frame is stored in its entirety and then changes from that 4ey frame are stored. -escribe a situation in which spatial video compression would be effective. $patial video compression removes redundant information within a frame. This type of compression is good for landscapes in which there are large bloc4s of color that are the same such as a blue s4y. -efine sampling as it relates to digiti!ing sound waves. To digiti!e the signal& we periodically measure the voltage of the signal and record the appropriate

54.

55.

56.

57.

58.

59.

60.

61.

62. 63. 64.

65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76.

77. 78. 79.

numeric value. #nstead of a continuous signal& we have a series of numbers representing distinct voltage values. Thus& we have a sample of the original continuous signal. 6hich produces better sound quality& higher sampling rates or lower sampling rates7 ,igher sampling rates produce better sound quality. 6hat is the sampling rate per second that is enough to create reasonable sound reproduction7 =G&GGG -o vinyl record albums and compact discs record sound the same way7 Ko. 3inyl record albums use an analog representation& but compact discs store audio information digitally. 6hat does an )1B value of H;3G& G& 2FFI mean7 There is a medium contribution of red& no contribution of green& and a full contribution of blue. 6hat color does an )1B value of H2FF& 2FF& 2FFI represent7 6hite 6hat is resolution7 )esolution refers to the number of pi+els used to represent a picture. The 1#F format uses what technique7 1#F uses inde+ed color. 6hat are 1#F files best for7 1#F files are best for graphics and images with few colors. ,ow are the various video codecs ali4e7 .ost video codecs are bloc4 oriented8 each frame of a video is divided into rectangular bloc4s. ,ow are they different7 The codecs differ in how the bloc4s used are encoded. Kame two types of video compression. Temporal compression and spatial compression 6hat do we call the perception of the various frequencies of light that reach the retinas of our eyes7 %olor 6hat is the best format for photographic color images7 2/*1 6hat are the techniques called that shrin4 the si!es of movies7 3ideo codecs 6hat is the technique in which an application supports only a certain number of specific colors& creating a palette from which to choose7 #nde+ed color 6hat is the format that describes an image in terms of lines and geometric shapes7 3ector graphics 6hat format stores information on a pi+el by pi+el basis7 )aster graphics format 6hat is the difference between ,i%olor and True%olor7 ,i%olor uses ;< bits8 True%olor uses 2= bits.