Page 749 - AP Computer Science A, 7th edition
P. 749

10. (A) Since the first test (x >= 0) is true, the matching else part, y = –x, will not be executed. Since (x <= 100) is true, the matching else part, y = x ∗ 2, will not be executed. The variable y will be set to x ∗ 3 (i.e., 90) and will now fail the test y < 50. Thus, x will never be altered in this algorithm. Finalvaluesarex = 30andy = 90.


































































































   747   748   749   750   751