Multiple Choice
Which of the sets of statements below will add 1 to x if x is positive and subtract 1 from x if x is negative but leave x alone if x is 0?
A) if (x > 0) x++; else x--;
B) if (x > 0) x++; else if (x < 0) x--;
C) if (x > 0) x++; if (x < 0) x--;
Else x = 0;
D) if (x == 0) x = 0; else x++;
X--;
E) x++; x--;
Correct Answer:

Verified
Correct Answer:
Verified
Related Questions
Q4: If x is an int where x
Q5: A truth table shows, for the various
Q6: Given the nested if-else structure below, answer
Q8: If x is an int where x
Q9: The statement:<br>if (a >= b) a++; else
Q10: Assume that x and y are int
Q13: Assume that count is 0, total is
Q20: The idea that program instructions execute in
Q28: The statement {} is a legal block.
Q30: Explain what is meant by short circuiting