9,631 views

3 Answers

Best answer
40 votes
40 votes

Firstly, our requirement is for $x=1$ it makes '$0$' and for $x= 0$ it makes '$1$'

Let's consider options one by one:

  1. $x= 1+x$
    • For $x = 1$, it gives $2$ So, False
       
  2. $x= 1- x$
    • Here, B is correct, as 
      • For $x= 0$, it gives $1$.
      • For $x= 1$, it gives $0$.
         
  3. $x = x - 1$    
    • For $x=0$ , it gives $-1$. So, False
       
  4. $x = 1 \% x$
    • For  $x= 0$ , it gives $1 \% 0$ . I think it is undefined
    • Even if we consider $x = x\%1 $   
      • for $x= 0$ ,it gives $0\%1 = 0$ But we require $1$. 

So, Option (B) is correct.

edited by
0 votes
0 votes

option D,

as,

x=1%x

assigns remainder after dividing with 1 and hence x has to be 0 for getting remainder value anything other than 0.(as 1 divides every number>0 laugh)

Answer:

Related questions