Comprehension

These questions are based on the situation given below: A robot moves on a graph-sheet with x and y axes. The robot is moved by feeding it with a sequence of instructions. The different instructions that can be used in moving it, and their meanings are:

InstructionMeaning
GOTO(x, y)Move to point with coordinates (x, y) no matter where you are.
WALKX(p)Move parallel to the x-axis through a distance of p, in the positive direction if p is positive, and in the negative direction if p is negative.
WALKY(p)Move parallel to the y-axis through a distance of p, in the positive direction if p is positive, and in the negative direction if p is negative.
Question: 1

The robot reaches point (6,6) when a sequence of three instructions is executed, the first of which is a GOTO(x,y) instruction, the second is WALKX(2) and the third is WALKY(4). What are the values of \( x \) and \( y \) respectively?

Show Hint

In problems involving robot movement, break down each instruction and calculate the resultant coordinates step by step.
Updated On: Aug 5, 2025
  • 2, 4
  • 0, 0
  • 4, 2
  • 2, 2
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

The robot starts at an initial position, and the instructions are executed as follows: - GOTO(x,y) moves the robot to a specific point. - WALKX(2) moves the robot 2 units along the x-axis. - WALKY(4) moves the robot 4 units along the y-axis. To reach the final point (6,6), the initial coordinates of the robot are (4, 2) because after walking 2 units along the x-axis and 4 units along the y-axis, it reaches (6, 6).
Was this answer helpful?
0
0
Question: 2

The robot is initially at \( (x, y), x>0 \) and \( y<0 \). The minimum number of instructions needed to execute to bring it to the origin \( (0,0) \) if you are prohibited from using the GOTO instruction is:

Show Hint

When calculating the minimum number of instructions for a robot to reach the origin, consider the movement along each axis and apply the corresponding WALK instruction.
Updated On: Aug 5, 2025
  • 2
  • 1
  • \( x + y \)
  • 0
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

To move the robot to the origin, we need to move it along the x and y axes. Since the robot is initially at a point where \( x>0 \) and \( y<0 \), one instruction of WALKX(-x) and another instruction of WALKY(-y) would be sufficient to bring it to the origin.
Was this answer helpful?
0
0