Q50: Suppose a large group of people in a room were all born in the same year. Consider the following three algorithms, which are each intended to identify the people in the room who have the earliest birthday based on just the month and day. For example, a person born on February 10 is considered to have an earlier birthday than a person born on March 5. Which of the three algorithms will identify the correct people?

  • I thought “Beginning with the number 1, ask if anyone was born on that day of any month. Continue with the numbers 2, 3, and so on until a positive response is received. If only one person responds, that person has the earliest birthday. If more than one person responds, determine which person was born in the earliest month, and that person or those persons have the earliest birthday.” this was a correct algorithm but it is not
  • algorithm III will incorrectly determine that a person born on February 1 has an earlier birthday than a person born on January 5.

Q49: A teacher stores the most recent quiz scores for her class in the list scores. The first element in the list holds the maximum possible number of points that can be awarded on the quiz, and each remaining element holds one student’s quiz score. Assume that scores contains at least two elements. Which of the following code segments will set the variable found to true if at least one student scored the maximum possible number of points on the quiz and will set found to false otherwise?

  • my answer was wrong because while it correctly compares the student’s score to the maximum score, the code segment will fail to check the last element in the list. When index is equal to the length of the list, the loop will terminate without comparing the last student score in the list to the maximum possible score.

Q45

  • for this question, I failed to do math so I got it wrong

Q43: A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction. Which of the following is NOT a benefit of procedural abstraction?

  • the correct answer was “making the code run faster” because modularity and code reuse do not necessarily lead to faster-running code.

Q37: Based on the values in the table, which of the following best characterizes the algorithm for drawing n shapes, where n is a very large number?

  • the correct answer is “The algorithm runs in a reasonable amount of time because it will use approximately n^2 steps to draw n shapes.”
  • This is because As n increases, the number of steps is approximately equal to n^2 , which would make the algorithm polynomial. An algorithm with an efficiency that approximates n^2 is said to run in a reasonable amount of time.

Q27: Digital images are often represented by the red, green, and blue values (an RGB triplet) of each individual pixel in the image. A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossless transformation of the digital image?

  • the correct answer is “Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original; light areas appear dark, and colors are reversed.”
  • this is because if a negative of the original image is made, each RGB triplet value will be computed by subtracting the original value from 255. The original value can then be restored by subtracting the new value from 255. This process is lossless because the exact original can be restored.

Q24: Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers?

  • the answer was sorting data not searching data but im not sure why

Q22: An Internet service provider (ISP) is considering an update to its servers that would save copies of the Web pages most frequently visited by each user. Which of the following is LEAST likely to occur as a result of the update?

  • the answer is “Web sites that are not visited frequently might no longer be accessible to users.”
  • this is correct because the actions of the ISP will only affect how frequently visited pages are loaded into Web browsers. Pages not saved by the ISP are still accessed as they were before.

Q3

  • I counted how many links needed to be cut relative to point E but failed to consider that I should also count how many links need to be cut from point F. If I cut 3 links from point F then E would have no way of reaching F.