‹ Back to the paper
Choose the correct option.
What is the statement or expression at ?4?
- (i)j+1
- (ii)key
- (iii)array[j]
- (iv)array[i]
Show the code
void insertionSort(int array[])
{
int n = ?1?;
for (int j = 1; j < n; j++)
{
int key = ?2?;
int i = j - 1;
while ((i > -1) && (array[i] > ?3?))
{
array[i + 1] = ?4?;
i--;
}
?5? = key;
}
}Answer
Answer
AICorrect option: (iv)
Answer: (iv) array[i]
The larger element array[i] is shifted to array[i+1].
From ISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1, question 32(d).