Searching and Sorting Quiz 1

Question 1

Time: 00:00:00
What is the time complexity of given algorithm ?

void function (int n)
{
int a = 0;
for (int i = 0; i <= n; i++)
for (int j = n / 2; j <= n; j++)
for (int k = 1; k <= n; k = k * 2)
a++;
}

O((N^2)* (log N))

O((N^2)* (log N))

O(N^3)

O(N^3)

O(N log N)

O(N log N)

Constant

Constant

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Bubble sort is a sorting algorithm used to sort the elements of an array .Here is that array arr={7,9,17,16}. How many iterations does it require to sort the given array?

 

2

2

4

4

Zero

Zero

1

1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which design technique is used to find all the pairs of shortest distance in a graph from the following algorithm?

 

Divide And Conquer

Divide And Conquer

Greedy Algorithm

Greedy Algorithm

Backtracking

Backtracking

Dynamic Programming

Dynamic Programming

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Find the pivot element from the given input using median-of-three partitioning method.

8,7,9,3,6,2,4,1,0

6

6

9

9

4

4

1

1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
To sort an array of 3 million elements . Which of the following algorithm is best suited?

Bubble sort

Bubble sort

Insertion sort

Insertion sort

Merge sort

Merge sort

Quick sort

Quick sort

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What is the time complexity of the given algorithm ?

function (int n)
{
int i = 1;
while (i < n)
{
int j = n;
while (j > 0)
j = j / 2;
i = 2 * i;
}
}

O(n)

O(n)

O(log^2 n)

O(log^2 n)

O(n^2)

O(n^2)

O(n log n)

O(n log n)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Is Quick Sort a stable algorithm ?

False

False

True

True

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the run time complexity of heap sort algorithm?

O(N)

O(N)

O(N^2)

O(N^2)

O(N log N)

O(N log N)

O(log N)

O(log N)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Recursion is similar to which of the following?

Goto statement

Goto statement

Loop

Loop

If-else

If-else

Switch Case

Switch Case

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
When elements of array are already in sorted array. Which of the following is the fastest sorting algorithm ?

Quick Sort

Quick Sort

Merge Sort

Merge Sort

Insertion Sort

Insertion Sort

Bubble Sort

Bubble Sort

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Prime

PrepInsta Prime Video

Complete video course for Cognizant GenC Elevate

for Elevate
Get Prime Video
Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects