MCQ Test 3
Home | API | Notes |
My Thoughts...
Overall, I believe that I did pretty well on this MCQ. I got 4 questions wrong, and decided to go back and check the answers. This allowed me to rework each of them to understand where I may have messed up in my thinking while taking the MCQ.
This option is incorrect because in Grid II, the robot lands in the square in the middle of the grid facing right. It cannot turn right, but it can turn left. It moves forward up to the middle square of the top row, at which point it is facing up. At this point, it turns right and moves forward to the square in the upper right corner of the grid. At this point, the robot cannot move right, it cannot move left, and it cannot move forward. It thus stays in the REPEAT UNTIL loop forever, since Goal_Reached is never true.
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.
Incorrect, as the fourth statement assigns the value false to a. The fifth statement assigns the value false to c.
Correct. The first three statements assign values to the variables. The fourth statement assigns the value of (NOT (a OR b)) AND c to a. Since a OR b is true, NOT (a OR b) is false, so (NOT (a OR b)) AND c is false. The fifth statement assigns the value of c AND a to c. Since a is now false, c AND a is false. The last three statements display the values of the variables.
This algorithm will turn on the motor in some cases when the gate is already open, thus, this option is not correct.
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.
Incorrect. This code segment leaves the robot four rows above its starting position and two rows above the gray square.
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.