
Class_23_08_2024
Authored by Dr.R.Vignesh Dr.R.Vignesh
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
What is time complexity of fun()?
int fun(int n)
{
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
O(n2)
O(n*log(n))
O(n*log(n*Log(n)))
O(n)
2.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
What is the time complexity of fun()?
int fun(int n)
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = i; j > 0; j--)
count = count + 1;
return count;
}
Theta (n)
Theta (n2)
Theta (n*log(n))
Theta (n*(log(n*log(n))))
3.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3, and f4?
f1(n) = 2n
f2(n) = n(3/2)
f3(n) = n*log(n)
f4(n) = nlog(n)
f3, f2, f4, f1
f3, f2, f1, f4
f2, f3, f1, f4
f2, f3, f4, f1
4.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
What is the time complexity of the below function?
void fun(int n, int arr[])
{
int i = 0, j = 0;
for (; i < n; ++i)
while (j < n && arr[i] < arr[j])
j++;
}
O(n*log(n)2)
O(n*log(n))
O(n2)
O(n)
5.
MULTIPLE CHOICE QUESTION
2 mins • 5 pts
In a competition, four different functions are observed. All the functions use a single for loop and within the for loop, same set of statements are executed. Consider the following for loops:
A) for(i = 0; i < n; i++)
B) for(i = 0; i < n; i += 2)
C) for(i = 1; i < n; i *= 2)
D) for(i = n; i <= n; i /= 2)
If n is the size of input(positive), which function is most efficient(if the task to be performed is not an issue)?
A
B
C
D
6.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
What does it mean when we say that an algorithm X is asymptotically more efficient than Y?
X will be a better choice for all inputs
X will be a better choice for all inputs except possibly small inputs
X will be a better choice for all inputs except possibly large inputs
Y will be a better choice for small inputs
7.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
In the following function, let n >= m.
int gcd(n, m)
{
if (n % m == 0)
return m;
n = n % m;
return gcd(m, n);
}
theta (log(n))
Omega (n)
theta (log(log(n)))
theta (sqrt(n))
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
12 questions
Data Science Quiz
Quiz
•
University
15 questions
Assessment 08
Quiz
•
University
10 questions
TIC - S11
Quiz
•
University
15 questions
OS-Process scheduling
Quiz
•
University
10 questions
JSPS Competition Hackathon - Scratch Language - Grade 1
Quiz
•
2nd Grade - University
10 questions
cybercrime
Quiz
•
12th Grade - University
14 questions
Input, output and storage de
Quiz
•
8th Grade - Professio...
13 questions
Les écrans : amis ou ennemis de l'enfance ?
Quiz
•
University
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
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
5 questions
Examining Theme
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University