Hide and Seek One day, Bunny and his friends were playing hide and seek in the forest. Tom went along to hide. He finds an abandoned bag containing a board(8x8) game in a cave. He gets excited and starts playing the game only to realizes that it's magical. He has three chances to roll the dice. Each turn's outcome will lead into a new surrounding and some would be dangerous. If the outcome of rolling dices is in multiples of 3 then he will be caught in a dangerous phase. Note if any one outcome is multiple of 3, then tom is in danger. (If the outcome of rolling dices is either 0 or less than that you should tell Tom as "Invalid Turn". )
Answer options
A
BEGIN
DECLARE variables turn1,turn2,turn3
READ turn1, turn2, turn3
IF turn1>0 AND turn2>0 AND turn3>0 THEN
IF turn1%3==0 OR turn2%3==0 OR turn3%3==0 THEN
PRINT "Tom is in Danger"
ELSE
PRINT "Tom is Safe"
END IF
ELSE
PRINT "Invalid turn"
END IF
END
B
Incorrect pseudocode with wrong initialization/order
C
Incorrect pseudocode with missing loop or condition
D
Incorrect pseudocode with wrong output statement
Correct answer: BEGIN DECLARE variables turn1,turn2,turn3 READ turn1, turn2, turn3 IF turn1>0 AND turn2>0 AND turn3>0 THEN IF turn1%3==0 OR turn2%3==0 OR turn3%3==0 THEN PRINT "Tom is in Danger" ELSE PRINT "Tom is Safe" END IF ELSE PRINT "Invalid turn" END IF END
Explanation
The correct answer is: BEGIN DECLARE variables turn1,turn2,turn3 READ turn1, turn2, turn3 IF turn1>0 AND turn2>0 AND....