- [3 points] Represent 37 in binary, octal and hexadecimal (hex).
2 |37 1
---
2|18 0
---
2|9 1 so 37 = 1001012
--
2|4 0 100|101
-- 4 5
3|2 0 so 37 = 458
--
1 0010|0101
2 5
so 37 = 2516
Please use subscripts to indicate base.
- [1 points] Why are numbers represented in binary in a computer?
The real reason is that it is convenient and it was the easiest to build. Here is an interesting article which someone gives the answer.
Many of you stated that the only way to represent data is with current or no current. This is not true. Think about a dimmable light. We could clearly represent many different states with a dimmer switch.
OK, so I gave up on grading this one.
On top of this, there have been instances of computers built that use three possible values. See this article.
- [1 points] Why are hex and octal representations of numbers used in computer science?
They provide an easy to convert to/from shorthand for binary.
- [1 point each] Represent each number in decimal
- 10110102
1x26 + 1x24 + 1x23 + 1x21 = 90
- 3CAF16
3x163 + 12x162 + 10x161 + 15x160 = 15,535
- 47308
4x83 + 7x82 +3x81 = 2,520
You normally do not subscript base 10 numbers.
- [1 points each] Represent the following in 4 bit two's compliment.
- -1
1 is the same as 00012 Flip the bits: 1110
+1
----
1111
- -8
8 is the same as 10002 Flip the bits: 1011111
+1
----
1 0 00
- [1 points each] Convert the following 5 bit two's compliment numbers to decimal
- 01011
This starts with a 0, so it is a positive number.
Just compute the magnitude
1011 = 8+2+1 = 11
- 10000
This starts with a 1 so it is a negative number.
Flip the bits and add 1.
10000 -> 01111 +1 = 100000
This is the special case in two's compliment.
It is -2n-1 = -24 = -16
- 10101
The first bit is 1, so it is a negative number.
Flip the bits and add 1 to find the magnitude.
10101-> 01010 + 1 = 01011 = 11
So the original number is -11.
- 00000
This is 0.
- [1 point each] Define the following as they relate to computer architecture
- Register
A register is a short term memory location.
You really should say that this is a piece of memory or a storage unit of some type. "Registers are variables" is a nice way to think about it, but that is not really a very good definition.
- Central Processing Unit (CPU)
The central processing unit, or CPU is the portion of the computer which executes instructions.
- Arithmetic logic unit (ALU)
The arithmetic logic unit is the portion of the CPU which performs computations. Most mathematics (addition, subtraction,. ..), comparisons, and logical operations are performed in the ALU.
- Hertz
A Hertz is the SI measurement of frequency. One Hertz is equivalent to one cycle per second.
Hertz is used anywhere you are measuring frequency. It is not only related to the CPU, memory or other hardware components.
- [2 points] State and describe the actions that occur at each step of the fetch-decode-execute cycle. Include how each of the following are used
- Program Counter (PC)
- Instruction Register(IR)
- Memory
- Control Unit (CU)
- Arithmetic Logic Unit (ALU)
- General Purpose Register(s)
The fetch-decode-execute cycle consist of a series of actions within the
CPU to execute a single instruction.
The cycle begins by fetching the next instruction to be executed
from memory, the address of this instruction is stored in the
Program Counter (PC). This instruction is stored in the
Instruction Register (IR). Finally the PC is incremented by the
size of an instruction.
The decode portion of the cycle is performed by the Control Unit (CU) by
examining the data in the IR.
The CU then takes the steps necessary to execute the instruction , or
perform the action required by the instruction. This may include fetching
additional data from memory, loading or storing data contained in a general
purpose register, or instructing the Arithmetic Logic Unit to perform
a computation.
Once the execute phase is done, the Control Unit begins the cycle again
by fetching the next instruction.
Note that the question asks you to explain the fetch-decode-execute cycle in terms of the components. It does not ask you to define the components.