You are dividing a number by 10.This means if the number is divisible 10 then it will leave remainder 0 and if not then it will leave the last digit as remainder.
The unit's place of 39 is 9. 3942 means you are multiplying 39 for 42 times.
39 x 39 = y ,where the unit place of y is 1 because 9x9 =81 and unit place of 81 = 1
39 x 39 x 39 = 39 x y = z ,where the unit place of z is 9. Previously y = 1.Multiply 1 x 9 is same as 9.
so
39a % 10 = 1 when a is even
39a % 10 = 9 when a is odd
Here a = 42 =even
Hence remainder will be 1
ANSWER = 1