Suppose Y is an integer variable whose value is either 0 or 1. Which of the following is the equivalent of the statement if(Y==0) Y=1; else Y=0;?

Suppose Y is an integer variable whose value is either 0 or 1. Which of the following is the equivalent of the statement if(Y==0) Y=1; else Y=0;?

  1. a) Y = 1+Y
  2. b) Y = 1-Y
  3. c) Y = Y-1
  4. d) Y = 1%Y

From the Combined Bank Assistant Programmer (CSE) March 2021 – Preliminary exam, question 36 of 86.

More from this paper