Consider an array defined as M[0…..10][0…..20]. When we refer an array element M[P][Q], we wish to check that this is a valid access to an array element. Consider the following tests for validity of the array reference
I. The address of M[P][Q] is an address within the range of memory allocated for the array M
II. 0 ≤ P and 0 ≤ Q
III. P ≤ 10 and Q ≤ 20
Which of the following combinations of the above tests will minimally guarantees that the array access is valid?
- I and II
- II and III
- I and III
- Any two will not be enough. We need I, II, III.