Time complexity

Time complexity

University

10 Qs

quiz-placeholder

Similar activities

¿Cuánto sabes sobre la tecnología que cambia al mundo?

¿Cuánto sabes sobre la tecnología que cambia al mundo?

University

10 Qs

Examen Tema 1 - Simulación

Examen Tema 1 - Simulación

University

11 Qs

Relés

Relés

University

10 Qs

GOOGLE DRIVE

GOOGLE DRIVE

University - Professional Development

10 Qs

GIS Unit III

GIS Unit III

University

15 Qs

Desafio Santarenzinho

Desafio Santarenzinho

KG - University

11 Qs

Fundamentos Web

Fundamentos Web

University

15 Qs

AB1401 Case Study: Facebook

AB1401 Case Study: Facebook

University

12 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?

Discover more resources for Computers