This page contains questions and answers for the second quiz in CS100: Principles of Computer Science, a course based on the book The Most Comples Machine. The answers given here are sample answers only. There is always some variation in the answers that would receive full credit. The Notes contain any extra comments I happen to have; they are not parts of the answers.
Question 1: For each of the following circuits, determine whether the output is ON or OFF, given that the inputs are set as shown.
Answer: This is pretty easy. You just need to apply the rules for the individual gates. The circuits are, respectively, OFF, ON, and ON.
In the top left circuit, the output of the first AND gate is OFF, the output of the NOT gate is OFF, and therefore the output of the second AND gate (that is, the overall output of the circuit) is OFF. In the circuit on the top right, the output of the OR gate is ON, and then, since both of its inputs are ON, the output of the AND gate is ON. In the bottom circuit, the NOT gates essentially cancel each other out, except for a brief time delay. The top input of the rightmost OR gate is ON, and therefore the output of that OR gate is also ON. (In fact, you don't even really have to look at the bottom input, which happens to be OFF.)
Question 2: Draw the circuit specified by the Boolean algebra expression: ((A and (not B)) or (B and (not C)) or C.
Answer: The circuit can be constructed as follows. Intermediate outputs are labeled to show the expressions to which they correspond.
Question 3: Add the binary numbers 100110101 and 11110110.
Answer:Writing carries from one column to the next, we get
1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 1 1 0 ------------------- 1 0 0 0 1 0 1 0 1 1
Question 4: What is an ALU? What role does it play in a computer?
Answer: An ALU, or "Arithmetic-Logic Unit", is a circuit that performs arithmetic and logical calculations. It is a component of a CPU, where it performs any such computations necessary during the execution of a program.
Note: The text discusses an example of an ALU that has sixteen-bit binary numbers as its inputs and outputs and that can perform seven different operations. This is only an example. The ALU in an actual computer might work with larger or smaller numbers, and it might do other operations. (The tiny "minu-ALU" from Lab Number 2 is completely unrealistic as an example since it can do only two operations and works only on three-bit numbers. It was given as an exercise to show the general method by which an ALU can be constructed, but a real ALU would have to be larger and more complex.)
Question 5: What is meant by feedback in a logic circuit?
Answer: A feedback loop occurs in a logic circuit when the ouput wire of some gate is connected, either directly or through a sequence of other gates, to an input wire of the same gate. (Circuits with feedback do not correspond to expressions of Boolean algebra.)
Note:Memory circuits are the major application of circuits with feedback, but memory has nothing to do with the definition of feedback.