Part 1-
a. What is the "brains" of the computer?
b. What is the largest non-stationary component inside a hard drive?
c. How many distinct patterns can be stored in (answer 3 numbers):
1 bit?
2 bits?
3 bits?
d. Sally has written 100 KB poetry. About how many bits is that?
e. Alice takes 10 images every day, 2.1 MB apiece. About how much space does 100 days of images take up in GB?
f. Bob has 87 GB of video of his 1 year old learning to walk. If he deletes 99% of it (saving 1%), about how much is left in MB?
Part 2-
a. Consider an ethernet LAN as shown in lecture. To receive data each computer listens for what sort of packet on the wire?
b. Circle any of the following which are invalid IP addresses:
1.200.3.4
5.254.155.55
259.200.1.1
200.3.400.5
None of the above are invalid
c. The first router to get a packet computes the end-to-end route for that packet. (true or false):
d. Give an example of a domain name:
Part 3-
a. Suppose Alice and Bob work at Stanford and use symmetric AES encryption to exchange encrypted .xlsx spreadsheet files containing sensitive data. Bob gets an encrypted file from Alice in email, decrypts it, and starts working with it. What are two security features provided by the AES encryption in this scenario:
b. Suppose you are looking at an ebay login page and you are trying to decide if it is legitimate vs. a phishing page. How do you check?
c. How is a zombie DDOS attack on www.example.com implemented by a bad guy (one sentence):
d. Suppose you have a pub/priv key pair and the pub key has been made public. How do you sign a document?
Part 4-
Write code to change every pixel in the image like this: multiply the red value by 10 and change the green value to be the half the blue value.
image = new SimpleImage("something.jpg");
for (pixel: image) {
// your code here
Part 5-
For this problem image and back that are images that are the same size. Change the blue value in every pixel in image to be the same as the blue value from the pixel at 0,0 in the back image.
image = new SimpleImage("image.jpg");
back = new SimpleImage("back.jpg");
for (pixel: image) {
// your code here
Part 6-
Write code to change the image like this: for every pixel where both the green and blue values are over 100, change the pixel green and blue values to 0. However, only do this change for pixels in a 100 pixel wide stripe running down the left side of the image. Pixels outside the stripe should not be changed.
image = new SimpleImage("something.jpg");
for (pixel: image) {
// your code here
Part 7-
Suppose we are doing experiments with a purple background for bluescreening. Write code that detects the background of the image by checking for pixels where both the blue and red values are greater than the average. Rather than copying over pixels from some other image, just set the detected background pixels to be pure black.
image = new SimpleImage("something.jpg");
for (pixel: image) {
// your code here
Part 8-
For this problem there are 2 images, called image and back that are the same size. Change the red/green/blue values in every pixel in image by adding 10% of the corresponding value from the pixel at the same x/y in the back image.
image = new SimpleImage("image.jpg");
back = new SimpleImage("back.jpg");
for (pixel: image) {
// your code here
Part 9-
For this problem, image is "bird-blue.jpg" showing a bird in front of a blue background, and back shows "stanford.jpg". Write code to detect the bird using the avg technique, and blend the pixels of the bird into the stanford image, dividing each bird pixel value by 5.
image = new SimpleImage("bird-blue.jpg");
back = new SimpleImage("stanford.jpg");
back.setSameSize(image);
for (pixel: image) {
// your code here
Part 10-
Write code to print all the rows (boy or girl) with rank over 900.
table = new SimpleTable("baby-2010.csv");
for (row: table) {
Part 11-
Do more boy names end in "i" or "t"? Write code to count both types of boy names and report the counts like this:
i: 6
t: 2
table = new SimpleTable("baby-2010.csv");
for (row: table) {
Part 12-
Write code that prints all of the boy rows and also the rows where the rank is less than 10 regardless of gender. Print the rows in the same order as they appear in the table (rank 1, rank 2, rank 3 .., rank 1000), printing each row once.
table = new SimpleTable("baby-2010.csv");
for (row: table) {
Part 13-
This problem uses fields "gender", "tv", and "soda" in the survey database. Suppose that the survey included a "gender" field set to either "boy" or "girl". Consider the people who answered "Modern Family" as their favorite TV show. Among them, count the boys and girls who answered "Coke" as their favorite soda, and report boy/girl counts separately like this:
boys: 6
girls: 8
table = new SimpleTable("survey-2012.csv");
table.convertToLowerCase();
for (row: table) {
Part 14-
For this problem, you have the following spreadsheet with raw data associating un-explained numbers with different types of food.
a. What exactly goes in the cell immediately below the Healthy numbers to compute their total?
b. What exactly goes in the cell immediately below the Awesome numbers to compute their total?
c. "Mystery points" is defined as double the Healthy total plus three times the Awesome total. What exactly goes in the cell to the right of "Mystery points:" to compute it?