Practice
Resources
Contests
Online IDE
New
Free Mock
Scaler Events New
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
Scaler
Explore Offerings by SCALER
Events
Checkout Scaler Academy Events
New

DAA MCQ

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

Events | Powered By
1. 

Dijkstra’s algorithm is used to solve __________  problems?

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?

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?

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?

Get Placed at Top Product Companies with Scaler Know More 
Get Placed at Top Product Companies with Scaler Know More 
Get Placed at Top Product Companies with Scaler
Sat transparent 640a34d454880bf68e3bfdf33f2389f2214043f59ad18b4c7f7b114e834fb257.svg

Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Personalised feedback report with solutions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Real life Interview Questions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Identify exact topics to improve

Your feedback is important to help us improve.
Free Mock Assessment
Fill up the details for personalised experience.
All fields are mandatory
Current Employer *
Enter company name *
Graduation Year *
Select an option *
1992
1993
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
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1992
1993
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
*Enter the expected year of graduation if you're student
Current Employer *
Company Name *
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