edited by
1,774 views
0 0 votes

Answer the question based on the following information.
A robot moves on a graph sheet with X and Y-axis. 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:

Instruction Meaning
GOTO(x,y) Move to point with coordinates (x, y) no matter where you are currently
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.

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

  1. $2$
  2. $1$
  3. $\text{x+y}$
  4. $0$

1 Answer

0 0 votes

Robot can reach to initial point (0,0) . in two instructions  . 
 

WALKX(-X) ---> now robot will reach to  (0,y) where y<0
now WALKY(Y) ----> now robot will reach to (0,0) 

So only 2 insructions are required . 

option (A) is correct .

 

Position:
Show:

Related questions

0 0 votes
1 1 answer
2.3k
2.3k views
go_editor asked May 16, 2016
2,299 views
The question is followed by two statements I and II.Markif the question can be answered by any one of the statements alone, but cannot be answered by using the other stat...
0 0 votes
1 1 answer
2.5k
2.5k views
go_editor asked May 16, 2016
2,524 views
The question is followed by two statements I and II.Markif the question can be answered by any one of the statements alone, but cannot be answered by using the other stat...
0 0 votes
1 1 answer
2.0k
2.0k views
go_editor asked May 16, 2016
2,028 views
The question is followed by two statements I and II.Markif the question can be answered by any one of the statements alone, but cannot be answered by using the other stat...
0 0 votes
1 1 answer
2.0k
2.0k views
go_editor asked May 16, 2016
2,043 views
The question is followed by two statements I and II.Markif the question can be answered by any one of the statements alone, but cannot be answered by using the other stat...
0 0 votes
1 answers 1 answer
2.4k
2.4k views
go_editor asked May 16, 2016
2,407 views
The question is followed by two statements I and II.Markif the question can be answered by any one of the statements alone, but cannot be answered by using the other stat...