Proof

s2

Test Corrections

Question 1

s2

My answer: B, x=1, y=3, z=2

This is wrong because the x, y, and z values listed in option B all cause the code segment to work as intended

Correct answer: D, x=3, y=2, z=1

This answer is correct because the procedure sets z as the maximum, causing it not work as intended since x is the maximum value entered.

Question 27

s2

My answer: C)

This is wrong because the procedure increments the value of n too early, causing the function to not work as intended.

Correct answer: D)

This answer is correct because the procedure sets increments the value of n correctly, following the robot’s path perfectly.

Question 45

s2

My answer: A, When the problem can be solved in a reasonable time and an approximate solution is acceptable.

This answer is wrong because it doesn’t make sense that a heuristic solution would be useful when the problem can be solved in a reasonable time, since you’re better off trying to actually solve the problem then.

Correct answer: C, When the problem cannot be solved in a reasonable time and an approximate solution is acceptable.

This answer is correct because these are the exact conditions where a heuristic solution is desired.