Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 32(e)

1 mark

Computer ScienceISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1MCQImplementation of algorithms to solve problems

Choose the correct option.

What is the statement or expression at ?5?

  • (i)array[i+1]
  • (ii)i+1
  • (iii)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

Correct option: (i)

Answer: (i) array[i+1] After shifting, key is placed at position i+1.