Search Header Logo

DAA Quiz 1/GLBITM

Authored by Nitish Ranjan

English

University

Used 5+ times

DAA Quiz 1/GLBITM
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the time complexity of Quick Sort in the average case?

O(log n)

O(n)

O(n log n)

O(n^2)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The main key point behind Shell Sort and its advantages over simple insertion sort.

Shell Sort improves efficiency over simple insertion sort by allowing exchanges of distant elements

Shell Sort only works with small datasets.

Insertion sort is faster than Shell Sort for all cases.

Shell Sort does not allow any element exchanges.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Compare the time complexities of Merge Sort and Heap Sort. Which one is generally faster and why?

Heap Sort is generally faster than Merge Sort.

Merge Sort is generally faster than Heap Sort.

Both algorithms have the same time complexity and speed.

Merge Sort is slower due to its recursive nature.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the best-case time complexity of Merge Sort?

O(log n)

O(n^2)

O(n log n)

O(n)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Describe a scenario where using a linear time sorting algorithm is preferable over comparison-based sorting algorithms.

Using comparison-based sorting algorithms is faster for sorting integers within a limited range.

Linear time sorting algorithms are ideal for sorting large datasets with no known range.

Using a linear time sorting algorithm is preferable when sorting integers within a known, limited range.

Using a linear time sorting algorithm is best for sorting strings alphabetically.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Implement a basic version of Quick Sort in pseudocode.

function quickSort(array) { if (array.length <= 1) { return array; } let pivot = array[array.length - 1]; let left = []; let right = []; for (let i = 0; i < array.length - 1; i++) { if (array[i] < pivot) { left.push(array[i]); } else { right.push(array[i]); } } return quickSort(left).concat(pivot, quickSort(right)); }

function quickSort(array) { return array; }

function quickSort(array) { for (let i = 0; i < array.length; i++) { left.push(array[i]); } }

function quickSort(array) { let pivot = array[0]; }

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the worst-case time complexity of Shell Sort?

O(n log n)

O(n^2)

O(log n)

O(n)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?