CSE 110: Introduction to Computer Science!
Fall 2014
Name:!
Student ID #!
!
!
!
!
Homework 2!
Due: Friday, October 17, within the first 10 minutes of the start of class. This assignment should be
submitted on paper. If you do not type the assignment, please write neatly!!
This assignment is worth a total of 15 points. You must show all work to receive any credit for your
solutions.!
1. The (fictional) MST 3000 CPU has an 8-stage pipeline where each stage requires 1 CPU clock cycle to
complete. Compute the number of CPU cycles required to completely process a sequence of 15
machine instructions with and without pipelining. How many cycles did you save by using pipelining?
Be sure to show how you calculated your answers. (3 points)
!
!
2. Translate the hexadecimal value CA into binary, apply a 2-bit right circular shift, and then translate the
result back into hexadecimal. (2 points)
3. Translate the following machine instruction into Pep/8 machine language, and then into hexadecimal
(base 16). (4 points)
Add the contents of memory address 48 to Register 0
4. Write a for loop in Java that prints the integer values from 1 through n, counting by inc. For example,
if n is 25 and inc is 5, the loop will print the sequence
1
6
11
16
21
Your code should work for any positive values of n and inc. You may assume that the integer variables
n and inc have already been declared and assigned values. Just write the code for the loop! (3
points)
5. Consider the following list of disk service requests, received in the following order:
49, 12, 59, 22, 58, 33, 80
Assume that the disk head is currently located at position/cylinder 50. List the order in which these
requests will be processed using the shortest-seek-time-first algorithm. How far in all (in terms of
cylinders) will the disk head move to service these requests? (3 points)!
Stony Brook University