Homework 4 Solution

Homework 4 Solutions

```

1 point for attempting the question and getting it wrong, 3 if it was close, 5 if itâ€™s correct.

1. How many different patterns can be stored with 1 bit:
2

2. How many different patterns can be stored with 2 bits:
4

3. How many different patterns can be stored with 5 bits:
32

4. How many different patterns can be stored with 6 bits:
64

5. Number of bits in a byte:
8

6. Storing a number in 1 byte, what are the smallest and largest possible values:0
0 .. 255
(or -128 .. 127 signed, which we are not doing in CS101)

7. About how many bytes are required to store the text within the quotes: "Hello!!!":
8 (1 byte per character)

8. What is the main role of the CPU in a computer (1-3 words):
Do arithmetic, perform computation, the brain, etc.

9. What is the main role of RAM in a computer (1-3 words):
Temporary working storage, etc.

10. What is the main role of persistent storage in a computer (1-3 words):
Permanently hold data, etc.

11. Bytes written to flash storage are guaranteed to last for at least 25 years, true or false:
false

12. Following Moore's Law (24 month version), how many years are required for an
8x capacity increase:
6 years

13. You have 100 image files, each taking up 2500 KB. How much total space do they take up in MB?:
2500 KB * 100 = 250,000 KB = 250 MB

14. What is the total capacity of four 500 MB hard drives plus one 2 GB flash drive in GB:
2 GB + (4 * 0.5 GB) = 2 GB + 2 GB = 4 GB

15. Suppose we have a video camera that records at a rate of 1500 MB per hour. How many GB does it take to record 24 hours?

1,500 MB * 24 = 1.5 GB * 24 = 36 GB

16: Suppose there are 20,000 people at Stanford. How much capacity in GB is required to
store a 100 KB JPEG image of each person (in GB):
20,000 * 100 KB = 20 * 100 MB = 2000 MB = 2 GB

17. What is the name of the system that starts and stops programs running
on a computer:
Operating System

18.  When Firefox.exe is double clicked, the _________________________
instructions inside Firefox.exe are copied to
_________________________ where the _________________________ runs them.

What words go in the blanks?
Machine code, RAM, CPU

19. "_______ code" runs directly on the CPU (what word goes in the blank):
Machine code

20. "Javascript code does not run on the CPU directly. What happens when
you click the Run button in CS101 so the CPU has some code to run (one sentence):
The browser translates Javascript to machine code (under the hood it is a hybrid interpreter / compiler that does the translation, but CS101 does not get into that)

21. What system reclaims the RAM space of a program when it exits:
oOperating system

22. To change the operation of a program, change its "_______ code" (what word goes in the blank):
Source

23. Purchasing Microsoft Word includes the right to read and change its source code, true or false:
False

24. You have the legal right to download and change the Chrome source code, true or false:
True

25. Name three examples of open source software:
GCC, Linux, Firefox, Chrome, Audacity, etc.

```