Question discussion

What is the length of an array when its first index is denoted by i and last index is denoted by j?

359819Medium DSSSB TGT Computer Science 0 replies 0 views
0

What is the length of an array when its first index is denoted by i and last index is denoted by j?

  • Alength of an array = j - i
  • Blength of an array = j - i - 1
  • Clength of an array = j - i + 1
  • Dlength of an array = i + j
Correct answer: C

Explanation

The indices run from i to j, so the number of elements is j − i + 1.

Discussion 0

Nobody has replied yet. Start the discussion!