Computer Science Using C++ Name:
Password:
(optional)

Ch. 5, Section 2 Quiz

Directions:

Do not add extra spaces before or after an answer.

Answer

What is the value of m after the following line is executed?

m = 12 / 3 + 1 + 12 * 2 - 5;

 

What is the value of average after the following line is executed?

average = 95 + 86 + 25 + 23 + 36 / 6;

 

What is the value of t after the following line is executed?

t = (5 + 7) / 3 + 7 * 2 - 5;

 

What is the value of my_int after the following line is executed?

my_int = 5 + 8 / 2 - 16 / 2 + 3 * 6;

 

What is the value of n after the following line is executed?

n = 2 * 125 + 100 / (1 + 4);

 

If the value of r is 4 before the statement below is executed, what is the value of w after the statement?

w = r--;

 

If the value of r is 7 before the statement below is executed, what is the value of w after the statement?

w = --r;

 

If the value of r is 3 before the statement below is executed, what is the value of w after the statement?

w = r + 1;

 

If the value of r is 6 before the statement below is executed, what is the value of w after the statement?

w = ++r;

 

If the value of r is 10 before the statement below is executed, what is the value of w after the statement?

w = ++r;

 

 


Computer Science Using C++ Home Page | CMPSC 101 Home Page

Minich.com Web Design