Rutgers University CS 211 Sections 1 and 2, Spring 2006
Computer Architecture
Midterm Examination

Read this question paper carefully. Write your answers in the bluebooks provided. Make sure to write your name and your section number (1 or 2) on your bluebook. Do not write anything you want graded on the question paper. If you need another bluebook or if you have a question, please come to the front of the classroom.

  1. Recall the first homework assignment where you wrote a program to convert between number bases. Given the following arguments, write the expected output of the program. For instance, for "h d 10" you would write "hexadecimal 10 is decimal 16."
  2. Write the following decimal numbers as 8-bit binary numbers in two's-complement:
  3. Suppose x is 0x5a5a and y is 0xa5a5. Write the values, in hexadecimal, of the following C expressions:
  4. Let f(n) be true if and only if n is a prime number. Recall that a positive integer n is prime if and only if it is evenly divisible by exactly two positive integers: itself and 1. The number 1 is not prime.
  5. Draw a circuit diagram for the 3-input majority function using only NAND gates. (You may use 2 or 3 input NAND gates.)
  6. For each of the following, write T for true and F for false: