Multiple choice

Consider the following C-function in which a [n] and b [m] are two sorted integer arrays and c [n + m] be another integer array.

void xyz(int a[], int b[], int c[]) {
  int i, j, k;
  i = j = k = 0;
  while ((i < n) && (j < m))
    if (a[i] < b[j]) c[k++] = a[i++];
    else c[k++] = b[j++];
}

Which of the following condition(s) hold(s) after the termination of the while loop?

  1. only (i)

  2. only (ii)

  3. either (i) or (ii) but not both

  4. neither (i) nor (ii)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation