This is the third quiz from the course Computer Science 100: Principles of Computer Science, taught by David Eck. The answers that are included here are sample answers only. There might be many other answers to a given problem that would also receive full credit. See the home page for the text, The Most Complex Machine, for more information about the course.
Question 1: The terms location and address are related to a computer's main memory (or RAM). Explain these two terms. What is the difference between them?
Answer: The RAM consists of a sequence of locations. Each location is a memory unit that can hold a binary number. The locations are numbered sequentially, and the number that corresponds to a particular location is called the address of that location. Thus, locations are actual, physical spots in memory, and address are numbers that are used to pick particular locations out of all the possible locations.
Note: On the xComputer model computer, there are 1024 locations, and an address is a number between 0 and 1023. Each location on the xComputer holds a 16-bit binary number. However, the number of locations in memory and the size of the binary numbers that they hold vary from computer to computer. (This question was really a question about computers in general, not just about the xComputer.)
Question 2: Explain the difference between the instructions "ADD 42" and "ADD-C 42".
Answer: Each of these instructions tells the CPU to add a number to the value that is already stored in the accumulater and to put the resulting sum back into the accumulator. However, for the ADD 42 instruction, the number to be added is whatever happens to be stored in memory location number 42. For the ADD-C 42 instruction, on the other hand, the number to be added in the number 42 itself.
Question 3: The clock in xCompter does not keep time. What role does it play?
Answer: The clocs "ticks" by turning an output wire on and off. Each time this wire is turned on and off, one step of the fetch-and-execute cycle is performed. Thus, the ticking of the clock drives the whole operation of the CPU.
Note: The clock in xComputer also has a control wire named Stop-Clock. When this wire is off, the clock ticks and the computer runs; when it is on, the clock does not tick so the computer is not operating. But this doens't mean that the main purpose of the clock is to turn the computer on and off!
Question 4: Every fetch-and-execute cycle in xComputer begins with the same three substeps. State the purpose of doing each of these steps. (Why is the step necessary?)
Answer: At the beginning of the fetch-and-execute cycle, the address of the next instruction in memory is stored in the program counter register. The computer must fetch that instruction from the specified address, execute that instruction, and then -- in the next fetch-and-execute cycle -- go on to the next instruction. These first three steps of the cycle do the following: