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
Q13: If a break occurs within the innermost
Q13: Assume that boolean done = false, int
Q14: What does the break statement do?<br>A) ends
Q15: If x is an int where x
Q17: An if statement may or may not
Q19: If you create an ArrayList without specifying
Q20: The idea that program instructions execute in
Q21: How many times will the following loop
Q22: Code Segment Ch 05-1<br>if (a > 0)<br>
Q23: As in the other members of the