Effect of Comments on Program Execution
A student is debugging a program and finds this code segment:
x = 5
# x = x + 1
y = x * 2
Which of the following best describes the value of y after this code executes?
A
10, because the commented line is not executed
B
Error, because the comment interrupts the calculation
C
10 or 12, depending on the programming language
D
12, because all lines contribute to the calculation
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | foevito.rw | 1 | 1 | 0m 00s | 100 |
| #2 | devanshs905 | 1 | 1 | 0m 11s | 89 |
| #3 | emmalinecandersen | 1 | 1 | 0m 12s | 88 |
| #4 | jjacobs | 1 | 1 | 0m 21s | 79 |
| #5 | spiritgen02 | 1 | 1 | 0m 27s | 73 |
| #6 | soniahalepota2005 | 1 | 2 | 0m 26s | 64 |
| #7 | garudvihaan | 1 | 3 | 4m 53s | -213 |
Items per page:
10
1 – 7 of 7
APFIVE