Sunteți pe pagina 1din 2

COMP 2655 Mock Midterm 1 Questions

Important note: simply completing these sample questions does not mean you have studied
sufficiently for the real midterm exam! Some of these questions might be similar to those on the real
exam. However, the exam will also have other types of questions – some may be harder and some
may be easier. So, use this sample to help identify weak areas in your knowledge, but don’t rely on it
exclusively. Solutions to these questions will not be given.

1. Define the terms computer architecture and computer organization. As part of your answer,
explain the difference between the two.

2. What is the key difference between a “high level” and a “low level” programming language?

3. For this question, show your final answers in binary and hex. Represent +13310 in 12-bit:

a) unsigned
b) signed magnitude
c) two’s complement
d) one’s complement

4. Repeat (a)-(d) above for -13310.

5. Using Horner’s rule, convert 140345 to decimal.

6. Design a digital circuit which computes the bit-wise exclusive-or of two 4-bit values.

7. Draw the schematic diagram for a 3-bit “ripple carry” adder circuit (i.e. it takes two 3-bit operands
and produces a 3-bit direct result). You may treat the three full adder parts as 3 input / 2 output
“black boxes”. Also: include the logic for determining the NZVC status bits.

8. Pretend that you are designing a new computer. You wish it to have a 1M, byte-addressable
address space.

a) What should be the width of the address bus?


b) What must be the minimum width of the data bus?
c) Are there any advantages to using a wider data bus (e.g. 2 or 4 times the minimum)?

9. Consider a byte-addressable, two’s complement, little-endian architecture. Given that the


following 16-bit value (shown in hex) begins at address 100016 in main memory, what number is
being represented? Express your answer in decimal.

?
1000 01
1001 FF
?

10. As described in class, what are the three categories of instruction in a CPU’s instruction set?

Page 1 of 2
11. Define the term addressing mode.

12. For the code below, the programmer’s intention was to initialize D3 with the longword 5. Name
and explain the error exactly, and state when it will occur. Then, show how to fix the problem.

move.l 5,d3

13. Hand-execute each of the following 68000 instructions. For each, assume that initially D5 and D6
contain the longword contents shown below and that N, Z, V and C all zero. Show the longword
contents of D5 and D6 after each instruction, as well as the updated condition codes in N, Z, V
and C.

D5.L = $00FA9B02
D6.L = $FFFF0F01

D5.L: D6.L: N Z V C:

a) add.w d6,d5

b) sub.b d5,d6

c) lsl.l #4,d5

d) and.b d5,d6

14. Translate the following C++ code to 68000 assembly language. Be sure to reserve space in main
memory for both variables.

int x, y; // assume ints are global, signed 8-bit values

.
.
.

y = 7 + x % 2;

15. How would the previous assembly code need to be modified, if the ints were changed to unsigned,
16-bit values?

Page 2 of 2

S-ar putea să vă placă și