‹ Back to the paper
Fill in the blanks marked ?1?, ?2? ... so that the code works.
What is the statement or expression at ?5?
Answer
Answer
AI$?5? = 10$ (i.e. $num /= 10$) - removes the last digit of num so the loop processes the next digit in the next iteration.
(Verified by running the completed function: PalindromeNum(121) and PalindromeNum(1221) return true, PalindromeNum(123) returns false.)
From ISC 2018 Computer Science Paper 1, question 3(v).