The pages of a book are numbered 0, 1, 2 . upto M, M>0. There are four categories of instructions that direct a person in positioning the book at a page. The instruction types and their meanings are :
1. OPEN : Position the book at page No. 1
2. CLOSE : Position the book at page No. 0
3. FORWARD, n :From the current page move forward by n pages; if, in this process, page number M is reached, stop at M.
4. BACKWARD, n : From the current page, move backward by n pages; if in this process, page number 0 is reached, stop at page number 0.
In each of the following questions, you will find a sequence of instructions formed from the above categories. In each case, let $$n_1$$ be the page number before the instructions are executed and $$n_2$$ be the page number at which the book is positioned after the instructions are executed.
FORWARD, 10; FORWARD, 10. Which of the following statements about the above instructions is true?
Let's consider each statement one by one
A) Suppose M=50, $$n_1$$=5
In this case, $$n_2$$ = 5 + 10 + 10 = 25. Hence, $$n_2 - n_1 = 20$$ even though $$n_1 \neq 0$$. Hence, statement A is false.
B) Suppose M=21 and $$n_1$$=1
In this case, $$n_2$$ = 1 + 10 + 10 = 21. Hence, $$n_2 - n_1 = 20$$. Thus, if M>20 then this statement is true.
If M = 19
In this case, the process stops when M is reached. Hence, $$n_2$$=19 and $$n_2 - n_1 = 18$$. Hence, option B is true.
C) As we have seen earlier, $$n_2 - n_1 = 20$$ in this case. Hence, option C is false.
D) Suppose $$n_1=M$$. In this case, $$n_2 = n_1$$. Hence, option D is false.
Create a FREE account and get: