CUET Humanities Exam  >  CUET Humanities Tests  >  Computer Science Practice Tests: CUET Preparation  >  Test: Sorting - 2 - CUET Humanities MCQ

Test: Sorting - 2 - CUET Humanities MCQ


Test Description

10 Questions MCQ Test Computer Science Practice Tests: CUET Preparation - Test: Sorting - 2

Test: Sorting - 2 for CUET Humanities 2024 is part of Computer Science Practice Tests: CUET Preparation preparation. The Test: Sorting - 2 questions and answers have been prepared according to the CUET Humanities exam syllabus.The Test: Sorting - 2 MCQs are made for CUET Humanities 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Sorting - 2 below.
Solutions of Test: Sorting - 2 questions in English are available as part of our Computer Science Practice Tests: CUET Preparation for CUET Humanities & Test: Sorting - 2 solutions in Hindi for Computer Science Practice Tests: CUET Preparation course. Download more important topics, notes, lectures and mock test series for CUET Humanities Exam by signing up for free. Attempt Test: Sorting - 2 | 10 questions in 10 minutes | Mock test for CUET Humanities preparation | Free important questions MCQ to study Computer Science Practice Tests: CUET Preparation for CUET Humanities Exam | Download free PDF with solutions
Test: Sorting - 2 - Question 1

Consider an array of 5 elements - 47, 25, 82, 16 and 31. How many times will the numbers be swapped according to quick sort algorithm to sort them in ascending order?

Detailed Solution for Test: Sorting - 2 - Question 1

In the first pass, key = 47. Here, 82 from 1st subfile and 31 from 2nd subfile are swapped. It ends at number 16 which is swapped with the key, i.e. 47. This makes the array sorted.

Test: Sorting - 2 - Question 2

Which is the correct procedure for bubble sort?

Detailed Solution for Test: Sorting - 2 - Question 2

It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Sorting - 2 - Question 3

When would it be a good idea to use bubble sort?

Detailed Solution for Test: Sorting - 2 - Question 3

It would be a good idea to use bubble sort as a place holder, until you implement something else.

Test: Sorting - 2 - Question 4

What is the output of the first step of selection sort performed on the following input?
64 25 12 22 11

Detailed Solution for Test: Sorting - 2 - Question 4

Selection sort algorithm is used to sort the elements of an arrays by finding the maximum or minimum element of the array and then putting that element into its correct position to sort the array in ascending or descending order.
In the array given above, to sort it into an ascending array, the first step is to find the minimum element which is 11 and replace it with 64.
After the first step array becomes: 11 25 12 22 64
Hence, option 1 is correct.

Test: Sorting - 2 - Question 5

Consider the following array:
{16, 4, 9, 3, 18, 14, 15}
For the array, if A is the number of comparisons in bubble sort and B is the number of comparisons in selection sort, then

Detailed Solution for Test: Sorting - 2 - Question 5

If there are n elements in the list, then (n - 1) passes are required to compare the elements in the first pass.
Thus, total number of comparisons (A) in bubble sort for a list of N elements = n - 1 = 7 - 1 = 6
In selection sort, selecting the lowest element requires n - 1 + n - 2 + n - 3 + ... comparisons for n elements.

Hence, A < B.

*Answer can only contain numeric values
Test: Sorting - 2 - Question 6

How many comparisons are needed to sort an array of length 5 if a straight selection sort is used and the array is already in the opposite order?


Detailed Solution for Test: Sorting - 2 - Question 6

Consider the array: [5, 4, 3, 2, 1]
The 1st iteration will compare the 4 numbers (4, 3, 2, 1) with 5.
The 2nd iteration will compare next 3 numbers (3, 2, 1) with 4.
The 3rd iteration will compare next 2 numbers (2, 1) with 3.
The 4th iteration i will compare last number i.e.1 with 2.
So, total number of comparisons = 4 + 3 + 2 + 1 = 10
It can be viewed as the sum of the sequence of the first (n - 1) numbers starting by 1.
S = (n × (n - 1))/2 (here, n = 5)
S = 10

Test: Sorting - 2 - Question 7

Selection sort`s best case time complexity is

Detailed Solution for Test: Sorting - 2 - Question 7

Best Case Time Complexity is: O(N2).

Test: Sorting - 2 - Question 8

Insertion sort's average time complexity is

Detailed Solution for Test: Sorting - 2 - Question 8

Insertion sort, on average, takes O(n2) time.

Test: Sorting - 2 - Question 9

You have to sort a list L, consisting of a sorted list followed by a few 'random' elements. Which of the following sorting method would be most suitable for such a task?

Detailed Solution for Test: Sorting - 2 - Question 9

For a sorted list with few random numbers:

  • Bubble sort will take O(n2) time in best case.
  • Selection sort will take O(n2) time in best case.
  • Quick sort will take O(n2) time in this case because it is the worst case for quick sort.
  • Insertion sort will take O(n)

Insertion sort take time only to sort unsorted elements. Here most of the elements are sorted hence insertion sort will be the perfect choice.
So, option (4) is correct.

Test: Sorting - 2 - Question 10

Open addressing is a solution of

Detailed Solution for Test: Sorting - 2 - Question 10

Open addressing is a solution of collision.
The open addressing is another technique for collision resolution. Unlike chaining, it does not insert elements to some other data-structures. It inserts the data into the hash table itself.

28 tests
Information about Test: Sorting - 2 Page
In this test you can find the Exam questions for Test: Sorting - 2 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Sorting - 2, EduRev gives you an ample number of Online tests for practice

Top Courses for CUET Humanities

Download as PDF

Top Courses for CUET Humanities