294 views
0 votes
0 votes

let x be an integer which can take a value of either 0 or 1 .then the statement (x=0) ? x=1: x=0

  1. x=x+1
  2. x=1-x
  3. x=x-1
  4. none of these

according to me x=0 is always going to be true so that expression will evaluate to x=1 which is not matching with any of the option so answer should be D none of these

but in answer they ‘ve given B as true please confirm it.

1 Answer

0 votes
0 votes
According to me
they are saying we can take value of x as 0 or 1

and the statement says that if x = 0 then x = 1 else x = 0

now, if you take x = 0 then if condition is true and it evaluates x = 1;

and if we take x = 1 then if condition becomes false and it evaluates to x = 0;

options be satisfies this condition as

in option b (x1 = 1-x)

if we take x = 0 then it gives out x1 = 1

and if we take x = 1 then it gives out x1 = 0;

therefore, option b should be the answer.

No related questions found