49. Which expression has a value equal to the rightmost digit of the integer q = 16222?

Answer: B

Explanation:

B) q % 10

The rightmost digit of the integer q = 16222 can be obtained by using the modulo operation with 10. Thus, q % 10 gives the last digit, which is 2.

A) q % 10000

Using the expression q % 10000 will yield the last four digits of the integer q. In this case, it results in 16222, which does not indicate the rightmost digit, making this option incorrect.

B) q % 10

This option correctly identifies the rightmost digit of q. The expression q % 10 results in 2, which is indeed the last digit of the integer 16222.

C) 10 % q

The expression 10 % q calculates the remainder when 10 is divided by 16222. Since 16222 is greater than 10, this results in 10, which does not correspond to the rightmost digit of q, rendering this option incorrect.

D) q / 10000

Dividing q by 10000 will give a value of 1.6222, which does not reflect the rightmost digit of the integer. Thus, this option does not provide the required information about the last digit of q.

Conclusion

The expression q % 10 is definitively correct as it directly yields the rightmost digit of the integer 16222. All other options either provide irrelevant results or do not correspond to the last digit, confirming them as incorrect.