15 |
|
|
I chose the grid that correctly moves the robot to the gray square, in option D the grid incorrectly moves the robot to the gray square. |
17 |
The output will be true if input B is true; otherwise it will be false |
The output will be true no matter what the value of input B is. |
This option is correct. Because the value of input A is true, the resulting value coming out of the OR gate must be true. Because the value of input C is true, the resulting value coming out of the AND gate is true. The value of input B did not affect this result. |
27 |
coin_flip = 1 |
heads_counter = 2 |
This option is correct. There are 4 trials in the simulation, and the goal is to determine if there were an equal number of head and tails, or, in other words, 2 heads. In Step 2, heads_counter is incremented when coin_flip represents heads. The simulation will result in an equal number of heads and tails if heads_counter = 2. |
28 |
Algorithm I always works correctly, but Algorithm II only works correctly when the maximum value is not the first value in the list. |
Algorithm II always works correctly, but Algorithm I only works correctly when the maximum value is greater than or equal to − 1. |
This option is correct. If the list contained [-7, -2, -5], algorithm I would initially set the value of max to -1. Since no data value in the list is greater than -1, the value of max would remain -1, which is not the correct behavior. Algorithm II would set the initial value of max to -7, and then change the value of max to -2. For all cases, algorithm II would return the correct maximum value in the list. |
30 |
In all cases, a binary search of a sorted list requires fewer comparisons than a linear search. |
Generally, the advantage of using a binary search over a linear search increases as the size of the list increases. |
This option is correct. A binary search on a sorted list compares the target value to the middle value in the list. If that value is not the target value, the search continues on either the lower half or the upper half of the list, depending on whether the target value was lower than or greater than the number in the middle of the list. This process is repeated on each sublist until the target is found or there is no sublist to search. Due to this halving process, a binary search is more efficient than a linear search. As the size of the list increases, the improvement in search efficiency increases. |
34 |
I and III only |
I, II, and III |
This option is correct. Statement I is correct because software simulations can usually be built before a prototype car. Statement II is correct because simulations can be made that model components and their interactions. Statement III is correct because the results of computer simulations may be useful in presenting design possibilities to customers. |
36 |
Searching |
Selection |
This option is correct. The original algorithm added all the integers, but the new algorithm needs to add only the even ones. The new algorithm needs to choose whether or not the current integer in the list is even. |
37 |
A program that calculates a student’s grade based on the student’s quiz and homework scores |
A program that finds the shortest driving route between two locations on a map |
This option is correct. Finding the shortest driving route is an optimization problem that cannot be solved in a reasonable time, and a heuristic is a technique that can find an approximate solution more quickly when exact methods are too slow. |
40 |
Changing line 3 to a=b+10 |
Changinging lin 3 to b=10 |
This option is correct. Line 3 is executed only if the Boolean expression a equals zero evaluates to true. In the current version of the code the statement b, leftward arrow, a plus 10. would result in the value of 10 being stored in the variable b, since a equals 0. Changing line 3 to b, leftward arrow 10. would not affect the result. |
42 |
Is anyone there? |
Better late than never |
Sincle “is anyone there?” is absent”, then the program should display, “better late than never.” |
43 |
y+3 |
3y |
This option is correct. The value of the variable result is initially set to 0. The outer REPEAT block is executed three times, and the inner REPEAT block is executed y times. Any block inside both of these blocks will be executed 3y (3 multiplied by y) times. Since the innermost block increases the value of the variable result by 1, the final value of the variable result is 3y. |
44 |
last row first colum |
last row thrid colum |
This option is correct. The robot moves in repeated segments of two MOVE_FORWARD and one ROTATE_RIGHT. After three of these segments, the robot would end up in the position shown by this response. |
47 |
coin_flip=1 |
heads_counter=2 |
This option is correct. There are 4 trials in the simulation, and the goal is to determine if there were an equal number of head and tails, or, in other words, 2 heads. In Step 2, heads_counter is incremented when coin_flip represents heads. The simulation will result in an equal number of heads and tails if heads_counter = 2. |