
Time complexity
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Hemalatha Chennai
Used 60+ times
FREE Resource
Enhance your content in a minute
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)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
14 questions
Adm de SI - Sistemas integrados
Quiz
•
University
14 questions
Prueba Parcial de TIC
Quiz
•
University
15 questions
Fundamentals of Algorithms - Unit 1 - Test 1
Quiz
•
University
10 questions
Teoria General de los Sistemas IF1300
Quiz
•
University
10 questions
Quiz Network Cabling Structure - SSK20353 - Network Technology
Quiz
•
University
15 questions
Fundamentos de Git e GitHub
Quiz
•
12th Grade - University
14 questions
Excel Bezüge und Funktionen - SUMME, MAX, MIN, MITTELWERT
Quiz
•
University
14 questions
Sains Komputer Tingkatan 4 - 2.2.3 Menghasilkan gambar rajah
Quiz
•
1st Grade - Professio...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
