Answer to Question choice-3
The condition in the second if statement is always true,
since it is only reached when x is not 0. Just
omit the redundant test.
if(x == 0)
{
y = 1;
}
else
{
y = 2;
}
This particular statement could also be replaced by
y = (x == 0) ? 1 : 2;