Data Structure Questions and Answers-Bubble Sort

 

 Buy/Download all MCQ Ebook   >>>Click Here<<<

Data Structure Questions and Answers-Bubble Sort

Click on any option to know the CORRECT ANSWERS

Question 1
What is an external sorting algorithm?
A
Algorithm that uses tape or disk during the sort
B
Algorithm that uses main memory during the sort
C
Algorithm that involves swapping
D
Algorithm that are considered 'in place'
UPSC test Questions answers

Question 1 Explanation: 
As the name suggests, external sorting algorithm uses external memory like tape or disk.

Question 2
What is an internal sorting algorithm?
A
Algorithm that uses tape or disk during the sort
B
Algorithm that uses main memory during the sort
C
Algorithm that involves swapping
D
Algorithm that are considered 'in place'
Reasoning Questions answers

Question 2 Explanation: 
As the name suggests, internal sorting algorithm uses internal main memory.

Question 3
What is the worst case complexity of bubble sort?
A
O(nlogn)
B
O(logn)
C
O(n)
D
O(n2)
Biology Questions answers

Question 3 Explanation: 
Bubble sort works by starting from the first element and swapping the elements if required in each iteration.

Question 4
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
B

for(int j=arr.length-1; j>=0; j--) { 	for(int k=0; k<j; k++) 	{ 		
C

for(int j=arr.length; j>=0; j--) { 	for(int k=0; k<j; k++) 	{ 		if(arr[k<
D
None of the mentioned
Computer science Questions answers

Question 4 Explanation: 
The outer loop keeps count of number of iterations, and the inner loop checks to see if swapping is necessary.

Question 5
What is the average case complexity of bubble sort?
A
O(nlogn)
B
O(logn)
C
O(n)
D
O(n2)
Management Questions answers

Question 5 Explanation: 
Bubble sort works by starting from the first element and swapping the elements if required in each iteration even in the average case.

There are 5 questions to complete.

 

 Buy/Download all MCQ Ebook >>>CLICK HERE<<<