Link to Lesson w/ Completed Hacks

Quiz Corrections & Score

Q17

Removing any three connections actually won’t prevent B and C from communicating. For example, if connections A-C, C-D, and B-D are removed, then devices B and C would still communicate through path B-E-F-C.

Q25

For 2 * n to be outputted instead, a procedure could instead initialize result to 0 and then repeatedly add 2 to result a total of n times.

Q28

For these values, -5 will be added to result five times and -25 will be displayed.

Q41

While this solution may reduce disrespectful communication between players, it does not make use of input from a large number of users.

Q55

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.

Q58

Information about available running routes would not need to be collected from the user’s device. Also the user may not be currently located near the user’s home.

Q63

“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.”

Q64

This line should be removed. This return statement causes execution of the procedure to end early. As a result, if age is less than 18, result will never be assigned the value “minor”.

Q66

This code segment does not work as intended. For example, if “timer” is greater than 60, bonus will be initially assigned 1500, then decreased to 1000 in the first IF block. As a result, b onus will be assigned 1000 instead of the originally wanted 1500.

Q68

The code segment will iterate over myList from right to left, removing each element that is equal in value to the element immediately preceding it. For this list, the code segment will remove the sixth element (10), the fourth element (20), and the second element (10). This results in the list [10, 20, 10], which still contains duplicates.