Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with? A) 20 is printed, v ends up with 19 B) 19 is printed, v ends up with 20 C) 20 is printed, v ends up with 20 D) 19 is printed, v ends up with 19 E) cannot determine what is printed, v ends up with 20 Consider this code: “int s = 20; int t = s++ + –s;”. What are the values of s and t? A) s is 19 and t is 38 B) s is 20 and t is 39 C) s is 19 and t is 39 D) s is 20 and t is 38 E) s is 20 and t cannot be determined

LANGUAGE: JAVA

CHALLENGE:

Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with?

A) 20 is printed, v ends up with 19

B) 19 is printed, v ends up with 20

C) 20 is printed, v ends up with 20

D) 19 is printed, v ends up with 19

E) cannot determine what is printed, v ends up with 20



Consider this code: “int s = 20; int t = s++ + –s;”.

What are the values of s and t?

A) s is 19 and t is 38

B) s is 20 and t is 39

C) s is 19 and t is 39

D) s is 20 and t is 38

E) s is 20 and t cannot be determined

SOLUTION:

Q1-B) 19 is printed, v ends up with 20

Q2-E) s is 20 and t cannot be determined