Multiple choice technology programming languages

What will be the result of the expression a % b when a and b are of type int and their values are a = -17 and b = -6?

  1. 5

  2. -5

  3. -23

  4. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In most programming languages, the modulus operation sign follows the sign of the dividend. When -17 is divided by -6, the quotient is 2 with a remainder of -5, so -17 % -6 evaluates to -5.