Self Studies

Computer Scienc...

TIME LEFT -
  • Question 1
    5 / -1

    How many pass will run insertion sort to sort the 8 elements?

  • Question 2
    5 / -1

    The best case and worst case swaps in the slection sort respectively for n elements ?

  • Question 3
    5 / -1

    How many swaps are there in the bubble sort in worst case and best case respectively?

    Consider total number of elements are n.

  • Question 4
    5 / -1

    Which of the following sorting algorithms suit the given statements?

    Consider the total number of elements are n.

    Statement 1: Best case= zero swaps and n(n-1)/2  comparsions.

    Statement 2: Worst case = n(n-1)/2 swaps and  n(n-1)/2 comparsions.

    Statement 3: In best and worst cases total n-1 passes it runs.

    Statement 4: In the first iteration it sorts the highest element and for the next iterations sorts the next highest element. 

  • Question 5
    5 / -1

    Which sorting is using the given example?

    A player is playing a card game and sorting the cards. The Player first picks one card then picks the next card and put it after the first card if it is bigger or before the first card if it is smaller; then he picks another card and inserts it into its proper position.

  • Question 6
    5 / -1

    Consider the following array and what is the status of the array after the second pass when we use the selection sort?

    Input: 64 25 12 22 11

    Output: 11 12 22 25 64

    After the first pass: 11 25 12 22 64

  • Question 7
    5 / -1

    Consider the following array and what is the status of the array after the fifth pass when we use the insertion sort?

    Input: 4 3 2 10 12 1 5 6

    Output: 1 2 3 4 5 6 10 12

    After the first pass: 3 4 2 10 12 1 5 6

  • Question 8
    5 / -1

    Match the following sorting algorithm with their property. Consider all the sorting algorithms sorts in the ascending order.

    i) Bubble sort                        a) It sorts an array by continuously selecting the smallest member from the unsorted section and placing it at the beginning.

    ii) Selection sort                   b) The values from the unsorted component are selected and placed in the sorted part in the correct order.

    iii) Insertion sort                   c) It compares and swaps two adjacent items until they are no longer in the correct sequence.

  • Question 9
    5 / -1

    Consider array A has 5 elements A[ ]={ 30, 28, 12 , 24, 8}. How many inversions are there in the array after the 2 passes using the selection sort algorithm?

    Hint:

    Inversion: Let array A[1...n] be an array of elements, If the two indexes i, j of the array. If iA[j] then the pair i,j is known as inversion of the array. 

  • Question 10
    5 / -1

    How many swaps are required for the given array1 and array 2 using selection sort respectively?

    Note: The sorted array should be in increasing order.

    Array 1:  7 6 8 5 9 4 10 3

    Array 2: 10 9 8 7 6 5 4 3 

Submit Test
Self Studies
User
Question Analysis
  • Answered - 0

  • Unanswered - 10

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Submit Test
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now