Database Questions and Answers – Sorting

This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Sorting”.

1. Two main measures for the efficiency of an algorithm are
a) Processor and memory
b) Complexity and capacity
c) Time and space
d) Data and space
View Answer

Answer: c
Explanation: Depending on the time and space complexity only the algorithm for sorting will be chosen.

2. The time factor when determining the efficiency of an algorithm is measured by
a) Counting microseconds
b) Counting the number of key operations
c) Counting the number of statements
d) Counting the kilobytes of algorithm
View Answer

Answer: b
Explanation: The operations taking place with the time and space is counted.

3. The space factor when determining the efficiency of an algorithm is measured by
a) Counting the maximum memory needed by the algorithm
b) Counting the minimum memory needed by the algorithm
c) Counting the average memory needed by the algorithm
d) Counting the maximum disk space needed by the algorithm
View Answer

Answer: a
Explanation: Time complexity maintains the maximum time needed.
advertisement
advertisement

4. Which of the following case does not exist in complexity theory
a) Best case
b) Worst case
c) Average case
d) Null case
View Answer

Answer: d
Explanation: Null case cannot be counted as the factor for complexity.

5. The Worst case occur in linear search algorithm when
a) Item is somewhere in the middle of the array
b) Item is not in the array at all
c) Item is the last element in the array
d) Item is the last element in the array or is not there at all
View Answer

Answer: d
Explanation: Algorithmic complexity is concerned about how fast or slow particular algorithm performs.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The Average case occur in linear search algorithm
a) When Item is somewhere in the middle of the array
b) When Item is not in the array at all
c) When Item is the last element in the array
d) When Item is the last element in the array or is not there at all
View Answer

Answer: a
Explanation: Algorithmic complexity is concerned about how fast or slow particular algorithm performs.

7. The complexity of the average case of an algorithm is
a) Much more complicated to analyze than that of worst case
b) Much more simpler to analyze than that of worst case
c) Sometimes more complicated and some other times simpler than that of worst case
d) None of the mentioned
View Answer

Answer: a
Explanation: Algorithmic complexity is concerned about how fast or slow particular algorithm performs.
advertisement

8. The complexity of a linear search algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)
View Answer

Answer: a
Explanation: It refers to n values complexity in the algorithm which can be reduced by choosing the other algorithms.

9. The complexity of Binary search algorithm is
a) O(n)
b) O(log )
c) O(n2)
d) O(n log n)
View Answer

Answer: b
Explanation: This shows that it has a standard complexity in addressing.
advertisement

10. The complexity of Bubble sort algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)
View Answer

Answer: c
Explanation: Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

Sanfoundry Global Education & Learning Series – Database Management System.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.