Robot 机器人题测试卷
题目1
Two different starting positions of a robot are shown in the grids below. For both positions, robots are initially facing up. The robot can move into a white or gray square, but cannot move into a black region.
The program below was written 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.


pseudocode
REPEAT UNTIL GOAL_REACHED() {
IF CAN_MOVE(forward) {
REPEAT UNTIL (NOT(CAN_MOVE(forward))) {
MOVE_FORWARD()
}
}
ELSE IF CAN_MOVE(right) {
ROTATE_RIGHT()
REPEAT UNTIL (NOT(CAN_MOVE(forward))) {
MOVE_FORWARD()
}
}
ELSE {
ROTATE_LEFT()
REPEAT UNTIL (NOT(CAN_MOVE(forward))) {
MOVE_FORWARD()
}
}
}Question: In which starting position could the robot be to move correctly to the gray square?
- (A) Either Position I or Position II
- (B) Neither Position I nor Position II
- (C) Position I only
- (D) Position II only
题目2
At which possible ending location does the code place the robot?
pseudocode
REPEAT UNTIL(END)
{
IF(CAN_MOVE(forward))
{
MOVE_FORWARD()
}
ELSE
{
ROTATE_LEFT()
}
}
题目3
The code below is a robot algorithm, Which diagram matches the code? 
- (A)

- (B)

- (C)

- (D)

题目4
Which set of code will move the robot from start to stop and end facing the correct direction? The robot may not move into gray blocks. 
(A)

(B)

(C)

(D)

题目5
Which diagram matches the code below? 

题目6
Which set of code will move the robot from start to stop? The robot may not use gray blocks. 
(A)

(B)

(C)

(D)

题目7
The following grid contains a robot represented as a triangle. The robot is initially facing right. Which of the following code lines can replace the missing code to move the robot to the grey square?

题目8
pseudocode
Line 1: move ← INPUT( )
Line 2: REPEAT move TIMES
Line 3: {
Line 4: MOVE_FORWARD( )
Line 5: ROTATE_RIGHT( )
Line 6: }Which of the following are possible landing spots for the robot? 
- (A)

- (B)

- (C)

- (D)

题目9

pseudocode
y ← RANDOM ( 1, 10000)
REPEAT y TIMES
{
n ← RANDOM (0, 3)
REPEAT n TIMES
{
if CAN_MOVE FORWARD ; MOVE_FORWARD ( )
}
p ← RANDOM (0, 1)
REPEAT p TIMES
{
TURN_LEFT ( )
}
}What are the possible landing spots for the robot?
- (A)

- (B)

- (C)

- (D)

题目10

pseudocode
IF (TRUE = TRUE OR 7 < 6)
{
MOVE_FORWARD( )
MOVE_FORWARD( )
MOVE_FORWARD( )
}
IF (4 > 4 AND TRUE = FALSE)
{
MOVE_FORWARD( )
}
IF (3=3)
{
MOVE_FORWARD( )
MOVE_FORWARD( )
MOVE_FORWARD( )
}- (A)

- (B)

- (C)

- (D)

