Time complexity

Time complexity

University

10 Qs

quiz-placeholder

Similar activities

Cuestionario Steve Jobs

Cuestionario Steve Jobs

12th Grade - University

10 Qs

MATEMÁTICA III

MATEMÁTICA III

University

10 Qs

Quiz - CSE

Quiz - CSE

University

10 Qs

2024 - Struktur Data Quiz 1

2024 - Struktur Data Quiz 1

University

10 Qs

PRACTICA N° 5- USO DE HERRAMIENTAS INFORMÁTICAS

PRACTICA N° 5- USO DE HERRAMIENTAS INFORMÁTICAS

University

10 Qs

DSA quiz 3 set 1

DSA quiz 3 set 1

University

10 Qs

Types of Mass Media

Types of Mass Media

10th Grade - Professional Development

11 Qs

Introducción Redes Tele1 IB

Introducción Redes Tele1 IB

10th Grade - University

15 Qs

Time complexity

Time complexity

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Hemalatha Chennai

Used 60+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f()

ans = 0

for i = 1 to n:

for j = 1 to log(i):

ans += 1

print(ans)

Time Complexity of this program:

O(n)

O(nlogn)

O(n^2)

O(n^3)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

a = 0

for i = 1 to n:

a += i;

b = 0

for i = 1 to m:

b += i;

Time Complexity of this program:

O(n)

O(m)

O(n+m)

O(nm)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

a = 0

for i = 1 to n:

a += random.randint();

b = 0

for j = 1 to m:

b += random.randint();

Time Complexity of this program:

O(n)

O(m)

O(n+m)

O(nm)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

int a[n][n]

// Finding sum of elements of a matrix that are above or on the diagonal.

sum = 0

for i = 1 to n:

for j = i to n:

sum += a[i][j]

print(sum)

Time Complexity of this program:

O(n)

O(nlogn)

O(n^2)

O(n^3)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

int a[n][n]

sum = 0

// Finding sum of elements of a matrix that are strictly above the diagonal.

for i = 1 to n:

for j = i to n:

sum += a[i][j]

print(sum)

for i = 1 to n:

sum -= a[i][i]

Time Complexity of this program:

O(n)

O(nlogn)

O(n^2)

O(n^3)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

ans = 0

for i = 1 to n:

for j = n to i:

ans += (i * j)

print(ans)

Time Complexity of this program:

O(n)

O(nlogn)

O(n^2)

O(n^3)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def f():

int a[N + 1][M + 1][K + 1]

sum = 0

for i = 1 to N:

for j = i to M:

for k = j to K:

sum += a[i][j]

print(sum)

Time Complexity of this program:

O(N+M+K)

O(NMK)

O(NM+K)

O(N+MK)

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?