Capgemini
Company
Numerical Ability
Geometry
A robot moves on a graph sheet with x-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:
Instruction Meaning
GOTO(x,y) move to pt with co-ord (x,y) no matter where u are currently
WALKX(P) move parallel to x-axis through a distance of p, in the +ve direction if p is +ve and in –ve if p is –ve
WALKY(P) move parallel to y-axis through a distance of p, in the +ve direction if p is +ve and in –ve if p is –ve
The robot reaches point (5,6) when a sequence of 3 instr. Is executed, the first of which is GOTO(x,y) , WALKY(2), WALKY(4). What are the values of x and y??
i. 2,4 ii. 0,0 iii. 3,2 iv. 2,3
The robot is initially at (x.y), x>0 and y
Read Solution (Total 2)
-
- problem is wrong it should walkyx(p)and walky(p)
then soln will be 3,2 - 12 years agoHelpfull: Yes(20) No(4)
- Before walky2 and walky4 instructions
the robos current position is let (x,y)
after execution of instructions
point is (5,6)
i.e, x + 2 = 5 ==> x = 3
y + 4 = 6 ==> y = 2 - 9 years agoHelpfull: Yes(1) No(3)
Capgemini Other Question