Homework 2

 

Assigned: Friday, Jun 20, 2008

Due: 10:59PM, Mon, Jun 23, 2008

Points: 100

 

Follow the instructions in the web page: http://www.cs.unc.edu/~zlj/comp110/assignments.html to add the Header with pledge and submit it to the blackboard.

I. (50 pts) You will play a game with your computer. In order to play the game, you need to

1.      Download the file GuessNumber.java, which is at: http://www.cs.unc.edu/~zlj/comp110/Program/GuessNumber.java

2.      Open it using jGrasp

3.      Compile the program

4.      Run it

Play this game a few times and answer the following questions. Submit the answers using Blackboard

1.      Briefly describe this game;

2.      During every game, report the number of guesses and whether you win or lose

3.      Can you always win the game? Do you have any trick to always win the game?

II. (50 pts) Answer the following questions. Submit the answers using Blackboard

1.      Why is operation system needed?

2.      Why is secondary storage needed?

3.      Why would you prefer to write a program in a high-level language rather than a machine language?

4.      How many values can be represented by 
a. 4 bits     b. 1 byte     c.10 bits     d. 16 bits

5.      We often describe the main memory as horizontal mailboxes. Can you list their similarity as much as possible?