CB MCQ3 Review
Reviewing what I got wrong on the 3rd CB MCQ
- Problems I got wrong, and a review for the correct answer
- Problem 15 “A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following activities is LEAST likely to be effective in this purpose?”
- Problem 22 “For each grid, the program below is intended to move the robot to the gray square. The program uses the procedure Goal_Reached ( ), which evaluates to true if the robot is in the gray square and evaluates to false otherwise.”
- Problem 31 “A programmer is creating an algorithm that will be used to turn on the motor to open the gate in a parking garage. The specifications for the algorithm are as follows.”
- Problem 33 “Which of the following can be used as a replacement for so that the code segment works as intended?"
- Problem 38 “Which of the following code segments is equivalent to the code segment above?”
- Problem 39 “Consider the goal of modifying the code segment to count the number of squares the robot visits before execution terminates. Which of the following modifications can be made to the code segment to correctly count the number of squares the robot moves to?”
- Problem 49 “A city planner is using simulation software to study crowd flow out of a large arena after an event has ended. The arena is located in an urban city. Which of the following best describes a limitation of using a simulation for this purpose?”
- Problem 50 “Based on the values in the table, which of the algorithms appear to run in reasonable time?”
Problems I got wrong, and a review for the correct answer
Problem 15 “A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following activities is LEAST likely to be effective in this purpose?”
-
Putting all government forms on the city Web site Explanation : This option is correct. Putting all government forms on the city website is least likely to be effective in reducing the digital divide because all citizens may not have equitable access to the Internet.
Problem 22 “For each grid, the program below is intended to move the robot to the gray square. The program uses the procedure Goal_Reached ( ), which evaluates to true if the robot is in the gray square and evaluates to false otherwise.”
-
Grid I only Explanation : This option is correct. In Grid I, the robot moves forward to the end of the bottom row, turns right twice, moves forward twice, turns right twice, moves forward until the end of the middle row, turns left twice, moves forward twice, turns left twice, and moves forward until Goal_Reached is true.
Problem 31 “A programmer is creating an algorithm that will be used to turn on the motor to open the gate in a parking garage. The specifications for the algorithm are as follows.”
-
Check if the time is during business hours. If it is, check if the gate sensor is activated. If it is, check if the gate is open. If it is not, turn on the motor. Explanation : Correct. 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.
so that the code segment works as intended?"
Problem 33 “Which of the following can be used as a replacement for -
REPEAT 2 TIMES Explanation : Correct. The loop that repeats four times returns the robot to its starting position. The three lines of code that follow the loop move the robot one row up and leave it facing right. When this has been repeated twice, the robot is in the gray square.
Problem 38 “Which of the following code segments is equivalent to the code segment above?”
- Answer B | Explanation : Correct. The given code segment displays “positive” when num is positive, displays “negative” when num is negative, and displays “zero” when num is 0. This code segment produces the same result. When num is negative, “negative” is displayed. Otherwise, when num is 0, “zero” is displayed. Otherwise, “positive” is displayed.
Problem 39 “Consider the goal of modifying the code segment to count the number of squares the robot visits before execution terminates. Which of the following modifications can be made to the code segment to correctly count the number of squares the robot moves to?”
-
Inserting the statement count ← count + 1 between line 6 and line 7 Explanation : Correct. Inserting this statement between lines 6 and 7 increases the value of count once each time the robot moves forward, which keeps an accurate count of the number of squares the robot visits.
Problem 49 “A city planner is using simulation software to study crowd flow out of a large arena after an event has ended. The arena is located in an urban city. Which of the following best describes a limitation of using a simulation for this purpose?”
-
The model used by the simulation software often omits details so that it is easier to implement. Explanation : Correct. Simulations are limited by the model that is used. There may be many reasons for using a simplified model, including ease of implementation.
Problem 50 “Based on the values in the table, which of the algorithms appear to run in reasonable time?”
-
A and B Explanation : Correct. As the size of the list grows, the number of steps needed to sort the list grows at a linear rate, as the number of steps is equal to 10n for a list of size n. This is an example of a polynomial efficiency and indicates that the algorithm runs in a reasonable amount of time. Correct. The number of steps for this algorithm is equal to the length of the list squared, as the number of steps is equal to n2 for a list of size n. This is an example of a polynomial efficiency and indicates that the algorithm runs in a reasonable amount of time.