Conditional Algorithm Execution
Consider the following code segment.
x ← 5
IF (x > 3)
x ← 8
ELSE
x ← 2
x ← x + 1
Which statement best explains the final value of the variable x?
A
x becomes 3 because the ELSE condition is executed
B
x remains 5 because conditional statements are ignored
C
x becomes 9 because each assignment executes in sequence
D
x becomes 6 because only the first and last lines matter
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | jasonvikathompson | 4 | 5 | 1m 27s | 303 |
| #2 | ahmadfarzadtaquee | 2 | 2 | 1m 00s | 140 |
| #3 | tuleenalnashash | 1 | 1 | 0m 00s | 100 |
| #4 | ayyagarianjali | 1 | 1 | 0m 00s | 100 |
| #5 | ashvikkumawat | 2 | 3 | 1m 32s | 98 |
| #6 | gangulya111 | 1 | 1 | 0m 11s | 89 |
| #7 | andymeng14440 | 1 | 1 | 0m 16s | 84 |
| #8 | zachlastr3lla | 1 | 1 | 0m 16s | 84 |
| #9 | manya10rm | 1 | 1 | 0m 16s | 84 |
| #10 | afeldman0610 | 1 | 1 | 0m 19s | 81 |
Items per page:
10
1 – 10 of 27
APFIVE