Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

DAA MCQ

Last Updated: Jan 08, 2024
Certificate included
About the Speaker
What will you Learn?
Register Now

Algorithm

The algorithm is a step-by-step process to solve any problem and is a sequence of instructions that act on some input data to produce some output in a finite number of steps. The algorithm is independent of any programming language.

Why analysis of algorithms?

  • For a given problem, there are many ways to design algorithms for it
  • Analysis of algorithms to determine which algorithm should be chosen to solve the problem.

 The complexity of algorithm on performance analysis of algorithm:

  • Time complexity:  time complexity of an algorithm is the total time required by the program to run till its completion
  •  Space complexity:  Space complexity is the total space required by an algorithm to run till its completion.

Time and space complexity depends on lots of things like hardware, OS, processes, etc.

The analysis is of two types:

  • Posteriori analysis: In Posteriori analysis, Algorithm is implemented and executed on certain fixed hardware and software. Then the algorithm is selected which takes the least amount of time to execute. Hence, the time used is given in time units like ms, ns, etc.
  • Priori analysis: In Priori analysis, The time of the algorithm is found prior to implementation. Here time is not in terms of any such time units. Instead, it represents the number of operations that are carried out while executing the algorithm.

Asymptotic notations:

  • Asymptotic notations are used to represent the complexity of an algorithm
  • With the help of asymptotic notations, we can analyze the time performance of the algorithm.

There are three types of asymptotic notations:

  • Theta notation
  •  Omega notation
  •  Big Oh Notation

Design and Analysis of Algorithms MCQ

1. 

Dijkstra’s algorithm is used to solve __________  problems?

Create a free personalised study plan Create a FREE custom study plan
Get into your dream companies with expert guidance
Get into your dream companies with expert..
Real-Life Problems
Prep for Target Roles
Custom Plan Duration
Flexible Plans
2. 

The Bellmann Ford Algorithm returns __________  value?

3. 

Which of the following is used for solving the N Queens Problem?

4. 

Which of the following statements is true about AVL Trees?

5. 

Representation of data structure in memory is known as?

Learn via our Video Courses

6. 

In what time complexity can we find the diameter of a binary tree optimally?

7. 

To main measures of the efficiency of an algorithm are?

Advance your career with   Mock Assessments Refine your coding skills with Mock Assessments
Real-world coding challenges for top company interviews
Real-world coding challenges for top companies
Real-Life Problems
Detailed reports
8. 

Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?

9. 

Which of the following is a Divide and Conquer algorithm?

10. 

Which of the following data structure is used to perform recursion?

11. 

Identify the best case time complexity of selection sort?

12. 

Another name of the fractional knapsack is?

13. 

Identify the approach followed in Floyd Warshall’s algorithm?

14. 

Hamiltonian path problem is _________?

15. 

What is the time complexity of the following code snippet in C++?

void solve() {
    string s = "scaler";
    int n = s.size();
    for(int i = 0; i < n; i++) {
        s = s + s[i];
    }
    cout << s << endl;
}
16. 

When a pop() operation is called on an empty queue, what is the condition called?

17. 

What is the time complexity of the binary search algorithm?

18. 

What will be the best sorting algorithm, given that the array elements are small (<= 1e6)?

19. 

What is the time complexity of the Sieve of Eratosthenes to check if a number is prime?

20. 

The worst-case time complexity of Quicksort is?

21. 

What is the technique called in which it does not require extra memory for carrying out the sorting procedure?

22. 

Identify the slowest sorting technique among the following?

23. 

Select the correct recurrence relation for Tower of Hanoi?

24. 

Identify the sorting technique which compares adjacent elements in a list and switches whenever necessary?

25. 

Among the following options which is the best sorting algorithm when the list is already sorted?

26. 

What is the best case time complexity of the binary search algorithm?

27. 

Which of the following algorithms are used to find the shortest path from a source node to all other nodes in a weighted graph?

28. 

Which of the following are applications of Topological Sort of a graph?

29. 

What is the time complexity in decreasing the node value in a binomial heap?

30. 

An algorithm is __________?

31. 

Which of the following is incorrect? Algorithms can be represented:

32. 

What is the time complexity to insert an element to the front of a LinkedList(head pointer given)?

33. 

What should be considered when designing an algorithm?

34. 

Which of the following is known to be not an NP-Hard Problem?

35. 

The worst-case time complexity of Selection Exchange Sort is?

36. 

Heap is a _____________?

37. 

What is the maximum number of swaps that can be performed in the Selection Sort algorithm?

38. 

Worst-case time complexity to access an element in a BST can be?

39. 

In a graph of n nodes and n edges, how many cycles will be present?

40. 

Kruskal’s Algorithm for finding the Minimum Spanning Tree of a graph is a kind of a?

41. 

Which of the following algorithms are used for string and pattern matching problems??

42. 

The time complexity for travel Singh all nodes in a binary search tree with n nodes and printing them in order is?

43. 

Identify the function of the stack that returns the top data element of the stack?

44. 

What is the best time complexity we can achieve to precompute all-pairs shortest paths in a weighted graph?

45. 

Which of the following functions provides the maximum asymptotic complexity?

46. 

The time complexity to find the longest common subsequence of two strings of length M and N is?

Excel at your interview with Masterclasses Know More
Certificate included
What will you Learn?
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test