Solution Manual for Computer Science: An Overview, 13th Edition

Solution Manual for Computer Science: An Overview, 13th Edition helps you grasp essential concepts faster with structured explanations.

Lily Green
Contributor
4.9
34
11 months ago
Preview (16 of 164 Pages)
100%
Log in to unlock

Page 1

Solution Manual for Computer Science: An Overview, 13th Edition - Page 1 preview image

Loading page ...

Solution Guideto AccompanyComputer Science: An OverviewTwelfthEditionJ. Glenn BrookshearDennis Brylow

Page 2

Solution Manual for Computer Science: An Overview, 13th Edition - Page 2 preview image

Loading page ...

Page 3

Solution Manual for Computer Science: An Overview, 13th Edition - Page 3 preview image

Loading page ...

1Chapter ZeroINTRODUCTIONChapter SummaryThis chapter introduces computer science as the discipline that seeks a scientific foundation fortopics such as computer design, computer programming, algorithmic processes, etc. It gives aninformal introduction to the concept of an algorithm (more detail is given in Chapter5) anddiscusses how this concept forms the foundation of the field known as computer science. Thechapter also presents a brief history of computing machineryand introduces the “Big Ideas ofComputer Science” of the College Boards codification,namely; algorithms, abstraction, creativity,data, programming, Internet, and impact. These can be found in “The Principles Project”,by OwenAstrachan and Amy Briggs,a publicationon theCS Principles website (www.csprinciples.org).A major goal of this chapter is to establish the concept of computer science as being theunderpinning for the development of the computer applications with which students are familiar.Most introductory students will have seen computer science only in the context of using applicationsoftware, Web browsing, and perhapssomeprogramming. Thus, they may not understand thedistinctionbetweenstudyingcomputerscienceandlearninghowtousetoday’scomputerapplication software. I find it helpful to explain that computer science deals with the developmentof tomorrow’s application software, rather than learning how to use the applications of today.Comments1. This introductory chapter is included to set the stagenot to be the final word on the topicspresented. The goal at this point is merely to develop an intuitive understanding oftheideas andthe terminology involved.2. When writing this introduction, I envisioned a chapter that would be used largely as a readingassignment. Students tend to start a new semester with a fresh, enthusiastic attitude. They are eagerto get started and have resolved that this semester "I'll keep up and stay organized." I like to takeadvantage of this enthusiasm. Thus, I assign this chapter as a reading assignment on the first day ofclass and spend very little time discussing it.In my courses,class presentation usually starts withmaterial from Chapter 1.3. Those of us who teach introductory computer science courses are always looking for interestingalgorithms to use as examples. Along these lines I've drawn from the art of origami (see the birdfolding algorithm in Chapter5) for some time. Introductory students seem to enjoy working with analgorithm that does something "different." I've also drawn from the field of magic for suchexamples. I hope you like the example in Figure 0.2 of the text and find it useful.4. Most beginning students don’t distinguish betweenusing current technologyand computerscience. They don't understand that there is much more to computer science than Web browsingand writing programs. In this regard, I like to use the following quote from Charles Darwin. "...science consists of grouping facts so that general laws and conclusions may be drawn from them."

Page 4

Solution Manual for Computer Science: An Overview, 13th Edition - Page 4 preview image

Loading page ...

25. The topics discussed throughout the text collectively provide an understanding of computerscience. There is probably no single topic that a student must know. (Do students really have toknow about error correctingcodes, two's complement arithmetic, or the significance of the haltingproblem?) So don't hesitate to skip a topic if it doesn't fit your course goals. On the other hand, Iencourage you to cover a wide range of topics. The goal is to introduce students to computer scienceby presenting a variety of topics in enough detail to expose the realities of the issues involved.(Eachindividual topic may not be necessary on its own, but together they paint an important picture.)Maintaining this perspective is perhaps more of a challenge when teaching a computer literacycourse than a course within a computer science curriculum. In these former cases there is atemptation to skip the more challenging or tedious topics since "they don't need to know thatanyway." In contrast, I prefer to go ahead and present such subjects in a manner compatible withthe audience and then adjust the level of assignments and exams to match the objectives of theparticular course and the abilities of the students.(I think a major problem in today's education isthat we avoid challenging topics. In turn, the students have learned to view formal course work asan irrelevant waste of time and treat it accordingly. They perform poorly, we decide we need tosimplify the course further, and the cycle continues.)

Page 5

Solution Manual for Computer Science: An Overview, 13th Edition - Page 5 preview image

Loading page ...

3Chapter OneDATA STORAGEChapter SummaryThis chapter presents the rudiments of data storage within digital computers. It introduces thebasics of digital circuitry and how a simple flip-flop can be used to store a single bit. It thendiscusses addressable memory cells and mass storage systems (magnetic disk, compact disks, andflash memory). Having established this background, the chapter discusses how information (text,numeric values, images, and sound) are encoded as bit patterns. There are twooptional sections,first in a brief introduction to Python highlighting the means by which a programming languageshides the details of memory represention.The seconddelvesmore deeply intodata storagetopicsby presenting the problems of overflow errors, truncation errors, error detection and correctiontechniques, and data compression.Comments1. Perhaps the most important comment I can make about this chapter (and the next one as well) isto explain its role in the chapters that follow. This involves the distinction between exposingstudents to a subject and requiring them to master the materiala distinction that is at the heart ofthe spirit in which the entire text was written. The intention of this chapter is to provide a realisticexposure to a very important area of computer science. It is not necessary for the students to masterthe material. All that is needed from this chapter in the remaining part of the book are the remnantsthat remain from a brief exposure to the issues of data storage.Even if thecourse you teach requiresa mastery of these details or the development of manipulation skills, I encourage you to avoidemphasizingbit manipulations and representation conversions. In particular, I urge you to avoidbecoming bogged down in the details of converting between base ten and binary notation. I can’tthink of anything that would be more boring for the students.(I apologize for stating my opinion.)2. Therequiredsections in this chapter cover the composition of main memory (as a backgroundformachine architecture in chapter 2 and data structures in chapter 8), the physical issues ofexternal data storage systems (in preparation for the subjects of file and database systemsin chapter9), and the rudiments of dataencoding (that serves as a background for the subject of data types andhigh-level language declaration statementsin chapter6). The optional sections explore the issues oferror handling, including transmission error detection and correction as well as the problem oftruncation and overflow errors resulting from numeric coding systems.3. As mentioned in the preface of the text, there are several themes that run throughout the text, oneof which is the role of abstraction. I like to include this theme in my lecture in which I introduce flip-flops. I end up with both flip-flop diagrams from the text on the board, and I emphasize that theyrepresent two ways of accomplishing the same task. I then draw a rectangle around each diagramand erase the circuits within the rectangles leaving only the inputs, outputs, and rectanglesshowing. At this point the two look identical. I think that this creates a strong visual image thatdrives home the distinction between an abstract tool’s interface with the outside world and theinternal details of the tool.This is a specific example of teaching several topics at the same timein this case, the conceptsof abstraction and encapsulation are taught in the context of teaching digital circuits.

Page 6

Solution Manual for Computer Science: An Overview, 13th Edition - Page 6 preview image

Loading page ...

44. Don’t forget about the circuits in Appendix B. I used to have students who continued to record anextra bit in the answer to a two’s complement addition problem when a carry occurredeventhough I had explained that all values in a two’s complement system were represented with thesame number of bits. Once I started presenting the addition circuit in Appendix B, this problemdisappeared. It gave the students a concrete understanding that the carry is thrown away. (Ofcourse, in a later coursecomputing studentswill learn that it really isn’t thrown away but saved asthe "carry bit" for potential use in the future, but for now I ignore this.) I have also found that a goodexercise is to ask students to extend the circuit in Figure B.3 so that it produces an additional outputthat indicates whether an overflow has occurred. For example, the output could be 1 in the case ofan overflow and 0 otherwise.5.For most students, seeing the reality of the things they are told is a meaningful experience. Forthis reason I often find it advantageous to demonstrate the distinction between numeric andcharacter data using a spreadsheet. Ilike toshow them how the manipulation of large numbers canlead to errors.7. I have found that students respond well to hearing about CDand DVDstorage systems, howsound is encoded, and image representation systems such as GIF and JPEG. I have often used thesetopics as a way of getting non-majors interested in technical issues.8. For students not majoring in computer science, topics such as two's complement and floating-point notation can get a bit dry. The main point for them to understand is that when information isencoded, some information usually gets lost. This point can be made just as well using audio andvideo, which are contexts that seem to be more interesting to the non-majors.Answers to Chapter Review Problems1.With a 1 on the upper input and a 0 on the lower input, all circuits willproduce anoutput 0. If instead a 0 ison the upper input and 1 is on the lower input, circuits b and c willproduce anoutput 1, and circuit a will stillproduce a0.2.a.The entire circuit is equivalent to a single AND gate.b.Theentire circuit is equivalent to an Exclusive OR gate.3. a.After the third pulse, this circuit willproduce anoutputof1 and 1. After the fourth pulse, both flip-flopsare flipped back to a 0 stateso the circuit willagain produce anoutputof0 and 0. It is interesting to notethat this circuitry forms a binary counter that will repeatedly count from 00 to 11. Thus, this circuit formsan abstract toolthat can be used as a building block in other circuits. Additional flip-flops can be addedto count through a larger range of numbers.b.A 1 will be sent on Output B on the 2nd, 6th, 10th… pulses of the clock.Likewise, a 1 will be sent toOutput C on the 3rd, 7th, 11th… pulses of the clock. A 1 will not be sent to any output on the 4th, 8th, 12th… pulses of the clock. As we move forward into the next chapter, a circuit similar to this can be used todrive the machine cycle (composed of fetch, decode, and execute). Output A would be connected to theinput that activates the fetch circuitry. Likewise Output B and Output C would be connected to thedecode and execute circuits respectively.4. This is a flip-flop that is triggered by 0s rather than 1s. That is, temporarily changing the upperinput to 0 will establish an output of 1, whereas temporarily changing the lower input to 0 willestablish an output of 0. To obtain an equivalent circuit using NAND gates, simply replace eachAND-NOT gate pair with a NAND gate.

Page 7

Solution Manual for Computer Science: An Overview, 13th Edition - Page 7 preview image

Loading page ...

55.AddressContents00020153020103536. 256 using two hexadecimal digits (16 bits) , 65536 using four hexadecimal digits (32 bits).7. a.11001101b. 01100111 c.10011010 d.11111111e.000100008. a.1b. 1c.0d. 09. a.A0Ab. C7B c. 0BE10. The image consists of 1024 x 1024 = 1,048,576 pixels and therefore 3 x 1,048,576 = 3,145,728 bytes,or about 3MB. This means that about 86 images could be stored in the 256MB camera storagesystem. (By comparing this to actual camera storage capacities, students can gain an appreciationfor the benefits of image compression techniques. Using them, a typical 256MB storage system canhold as many as 300 images.)11. 786,432. (Each pixel would require one memory cell.)12. Data retrieval from main memory is much faster than from disk storage. Also data in mainmemory can be referenced in byte-sized units rather than in large blocks. On the other hand, diskstorage systems have a larger capacity than main memory and the data stored on disk is less volatilethan that stored in main memory.13. There are 70GB of material on the hard-disk drive. Each CD can hold no more than 700MB. Thus,it will require at least 100 CDs to store all the material. That does not seem practical to me. On theother hand, DVDs have capacities of about 4.7GB, meaning that only about 15 DVDs would berequired. This may still be impractical, but its a big improvement over CDs. (The real point of thisproblem is to get students to think about storage capacities in a meaningful way.)14. There would be about 5,000 characters on the page requiring two bytesforeachtwo byteUnicodecharacter.So the page would require about 10,000 bytes or 10 sectors of size 1024 bytes.15. The novel would require about 1.4MB using ASCII and about 2.8MB iftwo byteUnicodecharacterswere used.16. The latency time of a disk spinning at3600revolutions perminuteis only 0.00833seconds.17. About11.4milliseconds.18. About 7 years!19. What does it say?20.hexnotation21. a.Does1000100001001101111011001010111001100100000001100010011000000110000/5=200100000001011110010000001101010001000000011110100100000001100100?0011000000111111b.Thetota0101010001101000011001010010000001110100011011110111010001100001lcosti0110110000100000011000110110111101110011011101000010000001101001s$7.25.

Page 8

Solution Manual for Computer Science: An Overview, 13th Edition - Page 8 preview image

Loading page ...

6011100110010000000100100001101110010111000110010001101010010111022. a.42 6F 65 73 2031 30 30 20 2F 20 35 20 3D 20 32 30 3Fb.54 68 65 20 74 6F 74 61 6C 20 63 6F 74 20 69 73 20 24 37 2E 32 35 2E23. 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, 1001024. a. 0011001000110011b.1011125. They are the powers of two. 1 10 100 1000 10000 10000026. a.15b. 1 c. 21 d.16e. 19 f. 0 g.5h.9i.17j. 25 k. 26 l. 2727. a. 111 b. 1011 c. 10000 d.10001e.1111128. a.1b.5c.-3 d.-1 e.1529. a. 100 b. 111 c.010d. 011 e.11030. a. 15 b.-12c.12d.-16 e.-1031. a.0001101b.1110011c. 1111111 d. 0000000 e.001000032. a. 01101 b. 00000c. 10000 (incorrect) d. 10001 e.11110f. 10011 (incorrect)g. 11110 h. 01101 i. 10000 (incorrect)j. 1111133. a.500101+ 1becomes+ 0000100110which represents6b.50010100101-1becomes-00001which converts to+ 1111100100which represents4c.120110001100-5becomes-00101which converts to+1101100111which represents7d.80100001000-7becomes-00111which converts to+ 1100100001 which represents 1e.1201100+5becomes+0010110001which represents-15(overflow)f.50010100101-11becomes-01011which converts to+ 1010111010 which represents-634. a. 33/4b. 4 5/16c. 13/16d. 1e. 2 1/4

Page 9

Solution Manual for Computer Science: An Overview, 13th Edition - Page 9 preview image

Loading page ...

735. a. 101.11b.1111.1111c.101.011d. 1.01e. 110.10136. a. 1 1/8b.-1/2c.-3/16 d. 9/3237. a.11111111b.01001000c. 11101111d.00101110e. 00011111 (truncation)38. 00111100, 01000110, and 0101001139. The best approximation of the square root of 2 is 1 3/8 represented as 01011011. The square ofthis value when represented in floating-point format is 01011111, which is the representation of 17/8.40. The value one-eighth, which would be represented as 00101000.41. Since the value one-tenth cannot be represented accurately, such recordings would suffer fromtruncation errors.42. a. The value is either eleven or negative five.b. A value represented in two's complement notation can be changed to excess notation bychanging the high-order bit, and vice versa.43. The value is two; the patterns areexcess,floating-point, and two's complement, respectively.44. bwould require too many significant digits. cwould require too large of an exponent. d wouldrequire too many significant digits.45. When using binary notation, the largest value that could be represented would change from 15to63. When using two's complement notation the largest value that could be represented wouldchange from 7 to31.46. 4FFFFF47. 112322134343548. yyxy xx yyxy xyx xx xyx49. Starting with the first entries, they would bex,y, space,xxy,yyx, andxxyy.50. Not a chance. MPEG requires transfer rates of 40 Mbps.51. a.Does100001000010001101111001100101101110011100100000100110001000110000000110000/5=2100100000100101111100100000000110101100100000100111101 100100000 1001100100?000110000 000111111b.Thetota101010100101101000001100101100100000001110100001101111001110100101100001lcosti101101100100100000001100011001101111101110011001110100100100000001101001s$7.25.10111001110010000010010010010011011100010111010011001000011010100010111052. The underlined strings definitely contain errors.11001110111011000000111111000110101 00100 0111053. The code would have a Hamming distance of 3. Thus, by using it, one could detect up to 2 errorsper character and correct up to 1 error per character.

Page 10

Solution Manual for Computer Science: An Overview, 13th Edition - Page 10 preview image

Loading page ...

854. a. HE b. FED c. DEAD d. CABBAGE e. CAFE55. Answers will vary as theexchange rates change daily.56.Answers will vary depending on the currency selected.57.This is an interactive exercise, results will depend on the browser.58.A change to the dollar amount would need to be made in each of the expressions.59.no_B= 123234234no_KB =no_B/ 1024no_MB =no_KB / 1024no_GB =no_MB / 1024no_TB =no_TB / 1024print(str(no_B) +'B')print(str(no_KB) +'KB')print(str(no_MB) +'MB')print(str(no_GB) +'GB')print(str(no_TB) +'TB')print(str(no_KB) +'KB')print(str(no_KB) +'KB')no_TB = 1.123no_GB = no_TB * 1024no_MB = no_GB * 1024no_KB = no_MB * 1024no_B= no_KB * 1024print(str(no_B) +'B')print(str(no_KB) +'KB')print(str(no_MB) +'MB')print(str(no_GB) +'GB')print(str(no_TB) +'TB')print(str(no_KB) +'KB')print(str(no_KB) +'KB')60.mins = 50secs = 23tot_secs =mins * 60 +secssamples_per_sec = 44100bytes_per_sample = 2tot_bytes = tot_secs * samples_per_sec * bytes_per_sampleprint(tot_bytes)61.‘**’ should be ‘*’ and ‘PRINT’ should be ‘print’

Page 11

Solution Manual for Computer Science: An Overview, 13th Edition - Page 11 preview image

Loading page ...

8Chapter TwoDATA MANIPULATIONChapter SummaryThis chapter introduces theroleof a computer's CPU. It describes the machine cycle and the variousoperations (or, and, exclusive or, add, shift, etc.) performed by a typical arithmetic/logic unit. Theconcept of a machine language is presented in terms of the simple yet representative machinedescribed in Appendix C of the text. The chapter also introduces some alternatives to the vonNeumann architecture such as multiprocessor machines.The optional sections in this chapter present a more thorough discussion of the instructionsfound in a typical machine language (logical and numerical operations, shifts, jumps, and I/Ocommunication), a short explanation of how a computer communicates with peripheral devices, andalternative machine designs.ThemachinelanguageinAppendixCinvolvesonlydirectandimmediateaddressing.However, indirect addressing is introduced in the last section (Pointers in Machine Language) ofChapter 7 after the pointer concept has been presented in the context of data structures.Comments1. Much of Comment 1 regarding the previous chapter is pertinent here also. The development ofskills in the subjects of machine architecture and machine language programming is not requiredlater in the book. Instead, what one needs is an image of the CPU/main memory interface, anunderstanding of the machine cycle and machine languages, an appreciation of the difference inspeeds of mechanical motion compared to CPU activities, and an exposure to the limited repertoireof bit manipulations a CPU can perform.2. To most students at this stage the terms millisecond, microsecond, nanosecond, and picosecondmerely refer to extremely short and indistinguishable units of time. In fact, most would probablyaccept the incorrect statement that activities within a computer are essentially instantaneous. Once astudent of mine wrote a recursive routine for evaluating the determinant of a matrix in aninterpreted language on a time-sharing system. The student tried to test the program using an 8 by 8matrix, but kept terminating the program after a minute because "it must be in a loop." This studentleft with an understanding of microseconds as real units of time that can accumulate into significantperiods.3. A subtle point that can add significantly to the complexity of this material is combining notationconversion with instruction encoding. If, for example, all the material in Chapters 1 and 2 is new toa student, the problem, "Using the language of Appendix C, write an instruction for loading register14with the value 124" can be much more difficult than the same problem stated as, "Using thelanguage of Appendix C, write an instruction for loading registerDwith the (hexadecimal) value7C." In general, notation conversion is a subject of minor importance and should not be allowed tocloud the more important concerns.4. If you want your students to develop more than a simple appreciation of machine languageprogramming, you may want to use one of the many simulators that have been developed for themachineinAppendixC.AniceexampleisincludedontheAddison-Wesleywebsiteathttp://www.aw.com/brookshearoryou can find other simulators by searching the Web.

Page 12

Solution Manual for Computer Science: An Overview, 13th Edition - Page 12 preview image

Loading page ...

95. Here are some shortprogramroutinesin the machine language presented in Appendix C of thetext, followed by their C language equivalents.(These examples are easily converted into Java, C++,and C#.)Eachmachine language routinestarts at address 10. I've found that they make goodexamples for class presentations or extra homework problems in which I give the students themachine language form and ask them to rewrite it ina high-level language.AddressContentsAddressContentsAddressContents0D0014201B0F0E00155A1C500F0016301D121020170F1E30115C18111F0D1230190E20C0130E1A122100C language equivalent:{int X,Y,Z;X = 92;Y = 90;Z = X + Y;}If the contents of the memory cell at address 1C in the preceding table is changed from 50 to 60 theC equivalent becomes:{float X, Y, Z;X = 1.5;Y = 1.25;Z = X + Y;}Here's another example:AddressContentsAddressContentsAddressContents0E00190F24200F001A20250110201B04265011021CB1270112301D2C2830130E1E12290F14201F0E2AB0150120502B18163021122CC0170F22302D001811230EC equivalent:{int X, Y;X = 2; Y =1;while (Y != 4) {X = X + Y; Y = Y + 1;}}

Page 13

Solution Manual for Computer Science: An Overview, 13th Edition - Page 13 preview image

Loading page ...

106. Here are two Cprogram segmentsthat can be conveniently translated into the machine languageof Appendix C.{int X, Limit;X = 0;Limit = 5;do X = X + 1 while (X != Limit);}Programsegmentin machine language:AddressContentsAddressContentsAddressContents0E00(X)1822 (R2 = 1)2210 (R0 = Limit)0F00(Limit)1901230F1020(X = 0)1A11 (R1 = X)24B1 (go to end11001B0E2528 if X == Limit)12301C50 (X = X+1)26B0 (return)130E1D12271A1420(Limit = 5)1E3028C0 (halt)15051F0E290016302011 (R1 = X)170F210E{int X, Y, Difference;X = 33;Y = 34;if (X > Y)Difference = X-Yelse Difference := YX}Programsegmentin machine language:AddressContentsAddressContentsAddressContents0D00(X)1D012D16 (Diff = X-Y)0E00(Y)1E24 (R4=FF)2E300F00(Diff)1FFF2F0F1020(X = 33) 2096 (R6=not Y)30B0 (branch to11212124313Ahalt)12302256 (R6=-Y)3290 (R0=not X)130D233633141420(Y = 34) 2450 (R0=X-Y)3450 (R0 =-X)15222516350316302625 (R5=80Hex)3650 (R0 = Y-X)170E278037021811(R1=X)2880 (mask low)3830 (Diff = Y-X)190D2950 7 bits)390F1A12(R2=Y)2AB5 (if R0=R53AC0 (halt)1B0E2B32 then Y>X3B001C23(R3=1)2C50

Page 14

Solution Manual for Computer Science: An Overview, 13th Edition - Page 14 preview image

Loading page ...

11Answers to Chapter Review Problems1.a. General purpose registers and main memory cells are small data storage cells in a computer.b. General purpose registers are inside the CPU; main memory cells are outside the CPU.(The purpose of this question is to emphasize the distinction between registers and memory cellsadistinction that seems to elude some students, causing confusion when following machine languageprograms.)2.a.0010001100000100b.1011c.0010101001013.Elevencells with addresses98, 99, 9A, 9B, 9C, 9D, 9E, 9F, A0, A1, andA2.4.CD5. Program Instruction Memory cellcounterregisterat02022211320432023206C000116. To compute x + y+z, each of the values must be retrieved from memory and placed in a register,the sum of x and y must be computed and saved in another register, z must beaddedtothat sum,and the final answer must be stored in memory.A similar process is required to compute (2x) + y. The point of this example is that themultiplication by 2 is accomplished by adding x to x.7. a.OR the contents of register 2 with the contents of register 3 and place the result in register 1.b.Move the contents of register E to register 1.c. Rotate the contents of register3 fourbits to the right.d.Compare the contents of registers 1 and 0. If the patterns are equal, jump to the instruction ataddress 00. Otherwise, continue with the next sequential instruction.e.Load register B with the value (hexadecimal) CD.8. 16 with 4 bits,64with6bits9. a.2677b.1677c.BA24d. A403e.81E210. The only change that is needed is that the third instruction should be 6056 rather than 5056.11. a.Changes the contents of memory cell 3C.b. Is independent of memory cell3C.c.Retrieves from memory cell 3C.d. Changes the contents of memory cell3C.e. Is independent of memory cell3C.12. a. Place the value55in register6. b.5513. a.1221b.2134

Page 15

Solution Manual for Computer Science: An Overview, 13th Edition - Page 15 preview image

Loading page ...

1214. a. Load register2with the contents of memory cell02.Store the contents of register2in memory cell42.Halt.b.32c. 0615. a.06b. 0A16. a. 00, 01, 02, 03, 04, 05b. 06, 0717. a.04b.04c. 0E18.04. The program is a loop that is terminated when the value in register 0 (initiated at 00) is finallyincrementedby twosto the value in register 3 (initiated at04).19.11microseconds.20. The point to this problem is that a bit pattern stored in memory is subject to interpretationitmay represent part of the operand of one instruction and the op-code field of another.a. Registers 0, 1, and 2 will contain 32,24, and 12, respectively.b. 12c. 3221. The machine will alternate between executing the jump instruction at address AF and the jumpinstruction at address B0.22. It would never halt. The first 2 instructions alter the third instruction to read B000 before it isever executed. Thus, by the time the machine reaches this instruction, it has been changed to read"Jump to address 00." Consequently, the machine will be trapped in a loop forever (or until it isturned off).23.a.b.c.14D814D8200034B315B31144C000358DB10A34BD22FFC000B00C22013246C00024. a. The single instruction B000 stored in locations 00 and 01.b.AddressContents00,012100 Initialize02,032270counters.04,053109 Set origin06,07320Band destination.08,091000 Now move0A,0B3000one cell.0C,0D2001 Increment0E,0F5101addresses.10,11520212,132333 Do it again14,154010if all cells16,17B31Ahave not

Page 16

Solution Manual for Computer Science: An Overview, 13th Edition - Page 16 preview image

Loading page ...

1318,19B004been moved.1A,1B2070 Adjust values1C,1D3071that are1E,1F2079location20,213075dependent.22,23207B24,25307726,27208A28,2930872A,2B20742C,2D30892E,2F20C030,3130A432,33200034,3520A536,37B070 Make the big jump!c.AddressContents00,012000 Initialize counter.02,032100 Initialize origin.04,052270 Initialize destination.06,072430 Initialize references08,091530to table.0A,0B310D Get origin0C,0D1600value.0E,0FB522 Jump if value must be adjusted.10,113213 Place value12,133600in new location.14,152301 Increment16,175003R0,18,195113R1, and1A,1B5223R2.1C,1D233C Are we done?1E,1FB370 If so, jump to relocated program.20,21B00A Else, go back.22,232370 Add 70 to24,255663value being26,272301transferred and28,295443update R4 and2A,2B342DR5 for next2C,2D1500location.2E,2FB010 Return (from subroutine).30,310305 Table of32,330709locations that34,350B0Fmust be36,37111Fupdated for38,39212Bnew location.3A,3B2FFF25.20A021A1600121A2600121A3600130A4C000
Preview Mode

This document has 164 pages. Sign in to access the full document!