Skip to the content.
Home Notes Create Task Data Structures Project Exam Preperation Quiz Corrections

Final Score - 42/50

image

Quiz Corrections:

Question 3

image The correct answer is only II only because algorithm III does not work correctly. Algorithm III chooses the person(s) with the earliest day, disregarding the month. For example, algorithm III will incorrectly determine that a person born on February 1 has an earlier birthday than a person born on January 5.

Question 7

image

The correct answer is D because the procedure initially sets result to 1 and j to 2. In the REPEAT UNTIL loop, result is first assigned the sum of result and j, or 1 + 2. The value of j is then increased to 3. In each subsequent iteration of the loop, result is increased by each successive value of j (3, 4, 5, etc.) until j exceeds n. Therefore, the procedure returns the sum of the integers from 1 to n.

Question 9

image

The correct answer is A and not B because because the expression would be used for a flowchart to set include to true whenever floor is greater than 1 0 and bedrooms equal 3. This does not correctly set include to true in cases where only one of the two conditions is true.

Question 23

image

I think I rushed this question. The answer isn’t A because the average number of daily messages sent per user appears to increase after the mobile app was released. Instead, the answer is D because the average number of characters per message appears to decrease after the mobile app was released.

Question 24

image

The correct answer is D because the algorithm continues past the first check if the time is during business hours, the algorithm continues past the second check if the gate sensor is activated, and the algorithm continues past the third check if the gate is not open. Performing the checks in this order will ensure that the gate is opened only under the appropriate conditions.

Question 36

image The option C is incorrect because when numCorrect is 7, the condition numCorrect > 7 evaluates to false. Therefore “check” is displayed as intended.

Question 47

image

The answer is D and not B because the code segment in D incorrectly sets bonus to 0 when 100 ≥ score ≥ 50 and incorrectly sets bonus to score when score < 50.