You need some help understanding why the following code compiles the way it does. These were questions that you recently had on test.
The point of this test was to see our knowledge of "braces" locations within the code. So this code is missing braces.
1. What is the value after the following code executes?
int (donuts = 10;
if (donuts!= 10)
donuts = 0;
else
donuts += 2;
Answers:
A. 12
B. 10
C. 0
D. 2
2. What is the value of donuts after the following code executes?
int donuts = 10;
if (donuts = 1)
donuts = 0;
else
donuts +=2;
Answers:
A. 12
B. 10
C. 0
D. 1