I am preparing for a Compilers exam and I found the following two questions in past papers that I don't know how to answer:
1. Array bounds checking requires code to check each array subscript to ensure it
falls within the array's declared range. How could induction variable analysis be
used to avoid repeated bounds checks in "for" loops.
2. Give a short example in Java in which one array address calculation is loop-
invariant and another array address is an induction variable.
I know what an invariant and induction variable means but I don't really know what is expected of me with regards to explaining these two solutions.
I would appreciate it if someone helped me with an explanation.
Thanks!