10. _______What is the value of the variable z after the following lines of code
ID: 3730238 • Letter: 1
Question
10. _______What is the value of the variable z after the following lines of code are executed?
int z = 5;
z = z * 3;
z = z + 1
A. 2
B. 16
C. 4
D. 15
E. either it’s undefined, or an error would be generated
11. _______An example of a logic error is
A. forgetting to initialize a variable
B. a calculation error leading to the wrong answer
C. a misspelled keyword (C++ command)
D. a variable with a confusing name
E. no comments in the program
12. _______What does the following program output?
const double PI = 3.14159;
PI *= 2;
cout << PI;
A. 3.14159
B. 6.28318
C. 2
D. 2.0
E. It generates a compiler error because a named constant such as PI cannot be modified.
Explanation / Answer
10. B. 16
11. B. a calculation error leading to the wrong answer
12. E. It generates a compiler error because a named constant such as PI cannot be modified.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.