567 views
0 votes
0 votes

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?

  1.   I and II
  2.  II and III
     
  3.  I and III
  4.  Any two will not be enough. We need I, II, III.

Please log in or register to answer this question.

No related questions found