In Questions 16 assume integer variables x20 y7 SHOW YOUR WO

In Questions 1-6 assume integer variables x=20, y=7 SHOW YOUR WORK FOR PARTIAL CREDIT. The value of ++x + 3 is The value of (x++) - (y++) is The value of (x++) - (-y) is The value of (x-) + (++x) is The value of (y-) + (++x) is The value of (++x) + (x--) + (y--) is

Solution

Answer 1:

Since x=20, hence ++x would give 21 and adding three would give the value 24.

Answer 2:

Since the post increment operators are used for both x and y, hence the variable values will be added and then the increment would take place. The value output would be 13.

Answer 3:

Since x has the post increment operator hence the value remains intact whereas value of y is decreased by one before evaluation.

The value output would be 14.

Answer 4:

x-- gives 19

++x gives 21

The value output would be 40.

Answer 5:

y-- keeps value of y as 7 intact

++x bumps value of x to 21. Adding both we would get 7+21=28.

The value output would be 28.

Answer 6:

++x gives 21.

x-- gives 20

y-- 7

The value output would be 48.

 In Questions 1-6 assume integer variables x=20, y=7 SHOW YOUR WORK FOR PARTIAL CREDIT. The value of ++x + 3 is The value of (x++) - (y++) is The value of (x++)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site