
Time complexity

Quiz
•
Computers
•
University
•
Medium
Hemalatha Chennai
Used 60+ times
FREE Resource
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(n∗m)
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(n∗m)
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(N∗M∗K)
O(N∗M+K)
O(N+M∗K)
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Python-loops, branches, functions

Quiz
•
University
13 questions
Init Me 3.1-1

Quiz
•
University
10 questions
Kuis 3 - ASD (B)

Quiz
•
University
15 questions
Knowledge Knockout[Quiz Round](2nd-4th years)

Quiz
•
University
8 questions
Revisando a Aula 4 Estrutura de Dados

Quiz
•
University
10 questions
AdvancedProgramming_intro

Quiz
•
University
13 questions
Idiomatic Python

Quiz
•
University
15 questions
PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
11 questions
NFL Football logos

Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms

Quiz
•
11th Grade - University
20 questions
La Hora

Quiz
•
9th Grade - University
7 questions
Cell Transport

Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University