Search Header Logo

QUIZ 1

Authored by HOD ICSB

Other

University

Used 7+ times

QUIZ 1
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

30 sec • 1 pt

Which of the following best describes the "worst-case" analysis of an algorithm?

The fastest time an algorithm takes

The maximum time on any input of size n

The average time taken

The space used by the algorithm

Answer explanation

The "worst-case" analysis of an algorithm refers to the maximum time it takes on any input of size n. This helps in understanding the upper limits of an algorithm's performance, making it crucial for evaluating efficiency.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the Big O notation used for?

Describing best-case performance

Describing the exact running time

Giving an upper bound of runtime

Giving a lower bound

Answer explanation

Big O notation is used to describe the upper bound of an algorithm's runtime, indicating the worst-case scenario for performance. It does not provide exact running times or best-case scenarios.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which asymptotic notation provides both an upper and lower bound?

O

Θ

Ω

o

Answer explanation

The correct choice is Θ (Theta) notation, which provides both an upper and lower bound for a function's growth rate. In contrast, O (Big O) provides only an upper bound, while Ω (Big Omega) provides only a lower bound.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the time complexity of the following loop?

O(n)

O(log n)

O(n²)

O(2^n)

Answer explanation

The loop has a nested structure, leading to O(n) iterations for each of the n elements, resulting in O(n²) time complexity. Thus, the correct answer is O(n²).

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which efficiency class is faster for large inputs?

O(n log n)

O(n²)

O(2^n)

O(n!)

Answer explanation

O(n log n) is more efficient than O(n²), O(2^n), and O(n!) for large inputs. As input size increases, O(n log n) grows slower, making it the fastest choice among the options provided.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the recurrence relation for Merge Sort?

T(n) = T(n-1) + O(n)

T(n) = 2T(n/2) + O(n)

T(n) = T(n/2) + O(1)

T(n) = T(n-1) + O(1)

Answer explanation

Merge Sort divides the array into two halves, recursively sorts them, and then merges the sorted halves. This leads to the recurrence relation T(n) = 2T(n/2) + O(n), where O(n) accounts for the merging process.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is commonly used to solve recurrence relations in recursive algorithms?

Divide-and-Conquer

Loop Invariant

Master Theorem

Hashing

Answer explanation

The Master Theorem is a powerful tool for analyzing the time complexity of recursive algorithms by providing a method to solve recurrence relations, making it the correct choice for this question.

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?