Final answer:
The correct line of code to return the tens digit of a given integer 'num' is 'num / 10 % 10'.
Step-by-step explanation:
To find the tens digit of a given integer, we want to eliminate all digits to the right of the tens place and then retrieve the rightmost digit of the remaining number. We can achieve this in two steps: First, divide the number by 10 to remove the last digit. Second, use the modulo operator % with 10 to obtain the last digit of the now truncated number, which is actually the tens digit of the original number. The correct line of code to complete the return statement is therefore option c) num / 10 % 10.
Examples:
- lastDigit(25437) would compute as 25437 / 10 % 10, which is 2543 % 10 equal to 3.
- lastDigit(189) would compute as 189 / 10 % 10, which is 18 % 10 equal to 8.