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
Q3: In Java, the symbol "=" and the
Q8: An if statement may or may not
Q15: As in the other members of the
Q16: If x is an int where x
Q17: Given the nested if-else structure below, answer
Q18: Given the nested if-else structure below, answer
Q19: Every Interator
A) has a hasNext( ) method
B)
Q21: For the questions below, assume that boolean
Q22: String s1 is said to overlap String
Q37: The following code has a syntax error
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents