My score: 61/70

Question 22

image image

  • For this question in particular I had accidentally mis-clicked the wrong answer when I was looking over it. However, the reason on why B is wrong is because this code segment causes the robot to end in the lower-right corner of the grid, facing toward the top of the grid.
  • This code segment causes the robot to rotate left before moving forward, causing the robot to follow a different path. The robot ends in the upper-right corner of the grid, facing toward the top of the grid.

Question 26

image

  • I had originial picked D which is wrong because searching for a key word in multiple documents can be done in parallel, where each processor performs a search on a different document (or part of a document).
  • The reason as to why A is correct is because the efficiency of a parallel computing solution is limited by the sequential portion of the solution. If each step is dependent on the preceding step, then each step must wait for the previous step to complete before executing. Therefore, the solution is completely sequential and does not benefit from parallel computing.

Question 28

image Answer Options:

  • A: j = -5, k = 5
  • B: j = 0, k = 5
  • C: j = 5, k = 0
  • D: j = 5, k = -5

Correct Answer: D

  • I chose A which was the incorrect answer, and the reason as to why it is not correct is because -5 will be added to result five times and -25 will be displayed.
  • And the reason as to why D is correct is because the value of k is repeatedly decremented by 1 inside the loop until k = 0. If k is initially negative, it will continue to decrease without ever reaching 0.

Question 49

image Correct Answer: D

  • For this question I picked B which is incorrect and the reason as to why it is incorrect is because that while some solutions benefit from parallel computation, not all problems can be solved with an algorithm.
  • The reason why D is the correct answer is because an undecidable problem is one for which no algorithm can be constructed that is always capable of providing a correct yes-or-no answer. Some instances of an undecidable problem may have an algorithmic solution, but there is no algorithmic solution that could solve all instances of the problem.

Question 53

image Answer Options:

  • A:
    • Step 4: Repeat steps 2 and 3 until the value of position is greater than n.
    • Step 5: If count is greater than or equal to 2, display true. Otherwise, display false.
  • B:
    • Step 4: Repeat steps 2 and 3 until the value of position is greater than n.
    • Step 5: If count is greater than or equal to position, display true. Otherwise, display false.
  • C:
    • Step 4: Repeat steps 2 and 3 until the value of count is greater than 2.
    • Step 5: If position is greater than or equal to n, display true. Otherwise, display false.
  • D:
    • Step 4: Repeat steps 2 and 3 until the value of count is greater than n.
    • Step 5: If count is greater than or equal to 2, display true. Otherwise, display false.

Correct Answer: B

  • I chose answer D which is ultimately wrong because it is not possible for count to be greater than n. Steps 2 and 3 will be continually repeated until the algorithm eventually attempts to access a list element at an index beyond the end of the list.
  • The reason as to why B is the correct answer is because step 4 checks every element of the list, incrementing count each time target appears. Step 5 prints true if and only if count appears multiple times in the list.

Question 55

image Correct Answer: C

  • I picked question A which is wrong because this code segment assigns the value of the last element of the list to the variable temp, then removes the last element of the list, then appends temp to the end of the list. The resulting list is the same as the original list.
  • The reason why answer C is correct is because this code segment assigns the value of the last element of the list to the variable temp, then removes the last element of the list, then inserts temp as the first element of the list.

Question 63

image Answer Options:

  • A: (NOT input1) OR (NOT input2)
  • B: (NOT input1) AND (NOT input2)
  • C: NOT (input1 OR input2)
  • D: NOT (input1 AND input2)

Correct Answer: A and D

  • I picked A and C which is technically half correct with A being correct, but C is incorrect because when input1 is true and input2 is false, then (input1 OR input2) will be true. Therefore, NOT (input1 OR input2) will be false instead of the intended value true.
  • A and D is correct because for D when input1 and input2 are both true, the expression (input1 AND input2) is true, so NOT (input1 AND input2) will evaluate to false. In all other cases, (input1 AND input2) will evaluate to false, so NOT (input1 AND input2) will evaluate to true. Then for A, when input1 and input2 are both true, the expressions (NOT input1) and (NOT input2) are both false, so (NOT input1) OR (NOT input2) will evaluate to false. In all other cases, either (NOT input1) or (NOT input2) (or both) will evaluate to true, so (NOT input1) OR (NOT input2) will evaluate to true.

Question 65

image Correct Answer: B and C

  • I originally picked B and D which again is half correct but not fully correct because D is incorrect. It’s wrong because hot AND humid evaluates to false, the body of the IF statement is not executed, and nothing is displayed.
  • The reason why B and C is correct is because for B NOT humid evaluates to true, the body of the IF statement is executed. Since hot OR humid evaluates to true, true is displayed. And then for C hot OR humid evaluates to true, the body of the IF statement is executed. Since hot is true, true is displayed.

Question 69

image Correct Answer: A and D

  • I had chosen one correct answer which was D, but my second answer B was incorrect. B is incorrect because the number of clouds in a particular picture cannot be determined from the date, time, and location metadata. To determine this information, the content of the picture itself must be analyzed.
  • The reason as to why A and D are the correct answers is because for answer D the location and date that a photo is taken is considered metadata about the image. This information can be used to determine whether two pictures were taken at the same location on different dates. And for answer A the time and date that a photo is taken is considered metadata about the image. This information can be used to determine the chronological order of the images.