CAT 1999QA Question 39

BasicsEasy
Passage / Data

Directions: Answer the questions 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:

​​​​​​​

The robot is initially at (x, y), x > 0 and 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

Answer & solution

  • 2

  • B

    1

  • C

    x + y

  • D

    0

Solution

Two instructions are needed, one parallel to the X-axis and the other parallel to the Y-axis. i.e. WALKX(–x) and WALKY (–y)

CAT 1999 QA Q39: The robot is initially at (x, y), x > 0 and y < 0. The minimum number of instructions needed to be executed to — Solution | TheCATExam