Details of this Paper

CS101 Final Exam




CS101 Final Exam;Code Reference;Code reference "cheat sheet" to be printed with exam;Image loop;image = new SimpleImage("something.jpg");for (pixel: image);pixel.setRed(0);print(image);Functions;-pixel.setRed(val) // likewise for green and blue;-pixel.getRed() // likewise for green and blue;-pixel.getX(), pixel.getY();-image.getWidth(), image.getHeight();-image.getPixel(x, y);-image.setSameSize(other_image);If-Statement;if (100 > 50);// body lines;Table loop;table = new SimpleTable("baby-2010.csv");table.convertToLowerCase();for (row: table);print(row);Table functions;-table.convertToLowerCase();-row.getField(field_name);-s1.startsWith(s2), s1.endsWith(s2);Table field names;baby: name, rank, gender, year;survey: color, tv, movie, book, sport, soda;Spreadsheet;=sum(B1:B10) // sum up column of numbers;=A1 + A2 * 10 // arithmetic based on other cells;Short Answer 1 (10);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?;Short Answer 2 (10);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;;;;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;Short Answer 3 (10);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 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? e. (not covered 2014);Image 1 (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;Image 2 (4);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;Image 3 (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;Image 4 (6);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;Image 5 (9);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;Image 6 (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;Table 1 (4);Write code to print all the rows (boy or girl) with rank over 900.;table = new SimpleTable("baby-2010.csv");for (row: table);Table 2 (6);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);Table 3 (9);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);Table 4 (9);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);Spreadsheet 1 (4);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?


Paper#67297 | Written in 18-Jul-2015

Price : $87