Search Header Logo

Quiz 1 (Time and Space Complexity)

Authored by Nishi Vanani

Information Technology (IT)

University

Used 14+ times

Quiz 1 (Time and Space Complexity)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Media Image

What is the time complexity of the following code?

O(n)

O(n²)

O(n log n)

O(log n)

2.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the space complexity of a recursive function that uses a stack for its operations?

O(n²)

O(n)

O(1)

O(log n)

3.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

In Big O notation, which of the following represents a linear relationship?

O(1)

O(n²)

O(n)

O(n log n)

4.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the best-case time complexity of a binary search algorithm?

O(1)

O(log n)

O(n)

O(n log n)

5.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

In Big O notation, which of the following represents a logarithmic relationship?

O(n²)

O(n)

O(n log n)

O(log n)

6.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following functions have a time complexity better than O(n²)?

O(n log n)

O(n!)

O(2^n)

None of the above

7.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Media Image

What is the space complexity of the following code?

O(1)

O(log n)

O(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?