Data Structures Algorithms-II MCQs

Page No. 9

What is the average number of inversions in an array of N distinct numbers?


aN(N-1)/4

✓


b N(N+1)/2

✖


cN(N-1)/2

✖


d N(N-1)/3

✖


View Answer N(N-1)/4

Any algorithm that sorts by exchanging adjacent elements require O(N2) on average.


aTrue

✓


b False

✖


cA & B

✖


dNone of these

✖


View Answer True

Which of the following algorithm implementations is similar to that of an insertion sort?


aBinary heap

✓


b Quick sort

✖


c Merge sort

✖


d Radix sort

✖


View Answer Binary heap

How many passes does an insertion sort algorithm consist of?


aN

✖


b N-1

✓


cN+1

✖


d N2

✖


View Answer N-1

Which of the following is not an exchange sort?


aBubble Sort

✖


bQuick Sort

✖


cPartition-exchange Sort

✖


dInsertion Sort

✓


View Answer Insertion Sort

In insertion sort, the average number of comparisons required to place the 7th element into its correct position is ____


a 9

✖


b 4

✓


c7

✖


d14

✖


View Answer 4

Statement 1: In insertion sort, after m passes through the array, the first m elements are in sorted order. Statement 2: And these elements are the m smallest elements in the array.


a Both the statements are true

✖


bStatement 1 is true but statement 2 is false

✓


cStatement 1 is false but statement 2 is true

✖


d Both the statements are false

✖



Consider an array of length 5, arr[5] = {9,7,4,2,1}. What are the steps of insertions done while running insertion sort on the array?


a 7 9 4 2 1 4 7 9 2 1 2 4 7 9 1 1 2 4 7 9

✓


b 9 7 4 1 2 9 7 1 2 4 9 1 2 4 7 1 2 4 7 9

✖


c7 4 2 1 9 4 2 1 9 7 2 1 9 7 4 1 9 7 4 2

✖


d7 9 4 2 1 2 4 7 9 1 4 7 9 2 1 1 2 4 7 9

✖



Which of the following is good for sorting arrays having less than 100 elements?


aQuick Sort

✖


b Selection Sort

✖


c Merge Sort

✖


dInsertion Sort

✓


View Answer Insertion Sort

Insertion sort is an example of an incremental algorithm.


aTrue

✓


bFalse

✖


cA & B

✖


dNone of these

✖


View Answer True

Goto Page No.

Page 9 of 149

Alphabetical MCQs Categories
—

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"
—

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan