Algorithm Selection Sort Quiz Quiestions

Reviewed by Godwin Iheuwa
Godwin Iheuwa, MS (Computer Science) |
Database Administrator
Review Board Member
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.
, MS (Computer Science)
Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By RosyU
R
RosyU
Community Contributor
Quizzes Created: 6 | Total Attempts: 42,509
Questions: 5 | Attempts: 10,033

SettingsSettingsSettings
Algorithm Selection Sort Quiz Quiestions - Quiz

In sorting bulk data in computer databases, we have different ways to help sort it out including shell sort and algorithm selection sort. In this quiz, we focus our attention to the former type of sorting data.


Questions and Answers
  • 1. 

    What are the correct intermediate steps of the following data set when it is being sorted with the Selection sort? 15,20,10,18

    • A.

      10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20

    • B.

      15,20,10,18 -- 15,10,20,18 -- 10,15,20,18 -- 10,15,18,20

    • C.

      15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20

    • D.

      15,10,20,18 -- 15,10,18,20 -- 10,15,18,20

    Correct Answer
    A. 10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
    Explanation
    The given data set is being sorted using the Selection sort algorithm. In each step of the algorithm, the smallest element from the unsorted portion of the list is selected and swapped with the element at the beginning of the unsorted portion.

    In the first step, the smallest element, 10, is selected and swapped with the first element, resulting in the list: 10, 20, 15, 18.

    In the second step, the smallest element from the remaining unsorted portion, 15, is selected and swapped with the second element, resulting in the list: 10, 15, 20, 18.

    In the third and final step, the smallest element from the remaining unsorted portion, 18, is selected and swapped with the third element, resulting in the final sorted list: 10, 15, 18, 20.

    Rate this question:

  • 2. 

    In a selection sort structure, there is/are?

    • A.

      Two separate for loops

    • B.

      Three for loops, all separate

    • C.

      Two for loops, one nested in the other

    • D.

      A for loop nested inside a while loop

    Correct Answer
    C. Two for loops, one nested in the other
    Explanation
    In a selection sort structure, there are two for loops, one nested in the other. This structure is used to sort a list of elements by repeatedly finding the minimum element from the unsorted part and placing it at the beginning. The outer loop iterates through each element of the list, while the inner loop compares the current element with the remaining elements to find the minimum. By nesting the inner loop within the outer loop, the algorithm can compare each element with all the remaining elements, ensuring that the minimum element is correctly placed.

    Rate this question:

  • 3. 

    Which one of the following is the first step in a selection sort algorithm?

    • A.

      The minimum value in the list is found

    • B.

      The maximum value in the list is found

    • C.

      Adjacent elements are swapped

    Correct Answer
    A. The minimum value in the list is found
    Explanation
    In a selection sort algorithm, the first step is to find the minimum value in the list. This is done by comparing each element with the current minimum value and updating the minimum if a smaller value is found. Once the minimum value is found, it is swapped with the first element in the list. This process is then repeated for the remaining elements in the list, finding the minimum value in each iteration and swapping it with the corresponding element. This continues until the list is fully sorted.

    Rate this question:

  • 4. 

    How many passes/scans will go through a list of 10 elements?

    • A.

      11

    • B.

      9

    • C.

      20

    • D.

      25

    Correct Answer
    B. 9
    Explanation
    Since there are 10 elements in the list, each pass/scan will go through one element. Therefore, there will be a total of 10 passes/scans. However, the question is asking for the number of passes/scans, not the number of elements. Therefore, the correct answer is 9, as the first pass/scan is not counted.

    Rate this question:

  • 5. 

    How many passes (or "scans") will there be through a list being sorted using a selection sort?

    • A.

      Array_size*2

    • B.

      Array_size+1

    • C.

      Array_size-1

    • D.

      None of the above

    Correct Answer
    C. Array_size-1
    Explanation
    In a selection sort, each pass involves finding the minimum element from the unsorted part of the list and swapping it with the first element of the unsorted part. After each pass, the sorted part of the list increases by one element. Since there are a total of array_size elements in the list, it will take array_size-1 passes to sort the entire list.

    Rate this question:

Godwin Iheuwa |MS (Computer Science) |
Database Administrator
Godwin Iheuwa, a Database Administrator at MTN Nigeria, holds an MS in Computer Science, specializing in Agile Methodologies and Database Administration from the University of Bedfordshire and a Bachelor's in Computer Science from the University of Port Harcourt. His proficiency in SQL Server Integration Services (SSIS) and SQL Server Management Studio contributes to his expertise in database management.

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 16, 2024
    Quiz Edited by
    ProProfs Editorial Team

    Expert Reviewed by
    Godwin Iheuwa
  • Dec 25, 2011
    Quiz Created by
    RosyU
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.