Consider the following steps – || ADRE 1.0 (SLRC 2022) Paper-I Solved Questions

QUESTION:

Consider the following steps – 


Step 1: Add 4.

Step 2: Subtract 1.

Step 3: If less than 15, jump to step 1 and continue from there; otherwise proceed to step 4

Step 4: Add 3

Step 5: If greater than 18, deduct 2.

What would be the final result if the above steps are followed with the initial value of 2?


(A) 11 

(B) 18 

(C) 17 

(D) 19


SOLUTION:


Initial value = 2


Step 1: Add 4

            2 + 4 = 6


Step 2: Subtract 1

            6-1= 5


Step 3: Since 5<15, jump to step 1 and continue from there and repeat

  • 5+ 4 = 9

  • 9 -1 = 8

  • 8 + 4 = 12

  • 12 - 1= 11

  • 11 + 4 = 15

  • 15 - 1 = 14

  • 14 + 4 = 18

  • 18- 1 = 17


Step 4: Since 17 > 15, add 3

17 + 3 = 20


Step 5: Since 20> 18, deduct 2

20 - 2 = 18


Correct option: (B) 18


Comments