CS 10051-003/004 Introduction to Computer Science - Spring 2008

Homework 5 - Chapter 6

Due Friday, April 4, 2008 at the start of the class period
A paper copy of the assignment is due by the beginning of class. Submissions may be neatly handwritten or typed. Electronic submission only (no hard copy) is a reduction in the homework score equivalent to 1%. 

# Question Description Answer Notes
1 #3 on Page 285

Assume that you write a letter in English and have a friend translate it into Spanish. In this scenario, what is equivalent to the source program of Figure 6.4? The object program? The assembler?

   
2 #4 on Page 285

Assume that memory cells 60 and 61 and register R currently have the following values:

  • Register R: 13
  • 60: 472
  • 61: -1

Using the instruction set in Figure 6.5, what is in register R and memory cells 60 and 61 after the completion of each of the following operations? Assume that each instruction starts from the above conditions.

a. LOAD 60

b. STORE 60

c. ADD 60

d. COMPARE 61

e. IN 61 (Assume that the user enters a 50.)

f. OUT 61

 
3 #7 on Page 285

What is the assembly language equivalent of each of the following binary machine language instructions? Assume the format described in Figure 6.13 and the numeric op codes values shown in Figure 6.5

a. 0101001100001100

b. 0011000000000111

 
4 #8 on Page 285

Is the following data generation pseudo-op legal or illegal? Why?

THREE: .DATA 2

 
5 #9 on Page 285 (d and e only)

Using the instruction set shown in Figure 6.5, translate the following algorithmic primitives into assembly language code. Show all necessary .DATA pseduo-ops.

d.

If (K<L) then output the value of K and increment K by 1
otherwise output the value of L and increment L by 1

e.

Set K to 1
	     Repeat the next two lines until K >100
		     Output the value of K
			 Increment K by 1
		 End of the loop
Only answer for parts d) and e)
6 #15 on Page 286 What value is entered in the symbol table for the symbols AGAIN, ANS, X and ONE in the following program? (Assume that the program is loaded beginning with memory location 0.)
	       .BEGIN
	       --Here is the program.
	       IN      X
	       LOAD    X
	AGAIN: ADD     ANS
	       SUBTRACT ONE
		   STORE   ONE
		   OUT     ANS
		   JUMP    AGAIN
		   ---Here are the data.
	ANS:   .DATA   0
	X:     .DATA   0
	ONE:   .DATA   1
	       .END
	
 
7 #19 on Page 286 Why are authorization lists so sensitive that they must be encrypted and protected from unauthorized change? What kind of damage can occur if these files are modified in unexpected or unplanned ways?  
8 #21 on Page 286 Here is an algorithm for calling a friend on the telephone.
Step Operation
1.
Dial the phone and wait for either an answer or a busy signal
2.
If the line is not busy then do steps 3 and 4
3.
	Talk as long as you want
4.
	Hang up the phone, you are done
5.
Otherwise (the line is busy) do steps 6 and 7
6.
	Wait exactly 1 minute
7.
	Go back to step 1 and try again

During execution this algorithm could get into a situation where, as in the deadlock problem, no useful work can ever get done. Describe the problem, explain why it occurs, and suggest how it could be solved.

 
9 #23 on Page 286 In a time-sharing operating system, why is system performance so sensitive to the value that is selected for the time slice? Explain what type of system behavior would occur if the value selected for the time slice were too large? Too small?  

Last Updated: Friday, March 28, 2008