# Quiz – 1

Question 1

Time: 00:00:00
Consider the situation in which assignment operation is very costly. Which of the following sorting algorithm should be performed so that the number of assignment operations is minimized in general?

Insertion sort

Insertion sort

Selection sort

Selection sort

Heap sort

Heap sort

None

None

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

Start

Question 2

Time: 00:00:00
The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array with improvised version?

4

4

2

2

1

1

0

0

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

Start

Question 3

Time: 00:00:00
What is the advantage of bubble sort over other sorting techniques?

It is faster

It is faster

Consumes less memory

Consumes less memory

Detects whether the input is already sorted

Detects whether the input is already sorted

All of the mentioned

All of the mentioned

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

Start

Question 4

Time: 00:00:00
Select the appropriate code that performs bubble sort.
a)

```for(int j=arr.length-1; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}```

b)

```for(int j=arr.length-1; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] < arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}```

c)

```for(int j=arr.length; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}```

A

A

B

B

C

C

D

D

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

Start

Question 5

Time: 00:00:00
Which of the following algorithm will be the slowest amongst the following

Shell

Shell

Heap

Heap

Quick

Quick

Bubble

Bubble

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

Start

Question 6

Time: 00:00:00
In breadth-first search, which of the following options is true?

Beginning from a node, first all its adjacent nodes are traversed.

Beginning from a node, first all its adjacent nodes are traversed.

Beginning from a node, each adjacent node is fully explored before traversing the next adjacent node

Beginning from a node, each adjacent node is fully explored before traversing the next adjacent node

Beginning from a node, nodes are traversed in cyclical order

Beginning from a node, nodes are traversed in cyclical order

none of these

none of these

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

Start

Question 7

Time: 00:00:00
Find the 3rd number from the left in the 3rd iteration while doing selection sort for - arr[] = 64 25 12 22 11

22

22

12

12

25

25

64

64

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

Start

Question 8

Time: 00:00:00
What is the third number from the left while doing bubble sort in the 3rd iteration for 5 1 4 2 8?

4

4

5

5

2

2

8

8

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

Start

Question 9

Time: 00:00:00
Binary Search can have _____ number of maxm comparsions?

log(n) + 1

log(n) + 1

2*log n

2*log n

n

n

(n+1)/2

(n+1)/2

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

Start

Question 10

Time: 00:00:00
Which of the following Sorting Algorithm will perform the worst if the numbers are ordered in the opposite form?

Quick Sort

Quick Sort

Bubble

Bubble

Selection

Selection

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

Start

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

Completed

0/0

Accuracy

0%

##### 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 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