Design and Analysis of Algorithms MCQs with answers Page - 13

Here, you will find a collection of MCQ questions on Design and Analysis of Algorithms. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 832.70K Points
Coach

Q. Which of the following is not a palindromic subsequence of the string “ababcdabba”?

  • (A) abcba
  • (B) abba
  • (C) abbbba
  • (D) adba

A

Admin • 832.70K Points
Coach

Q. For which of the following, the length of the string is not equal to the length of the longest palindromic subsequence?

  • (A) a string that is a palindrome
  • (B) a string of length one
  • (C) a string that has all the same letters(e.g. aaaaaa)
  • (D) some strings of length two

A

Admin • 832.70K Points
Coach

Q. What is the length of the longest palindromic subsequence for the string “ababcdabba”?

  • (A) 6
  • (B) 7
  • (C) 8
  • (D) 9

A

Admin • 832.70K Points
Coach

Q. What is the time complexity of the brute force algorithm used to find the length of the longest palindromic subsequence?

  • (A) o(1)
  • (B) o(2n)
  • (C) o(n)
  • (D) o(n2)

A

Admin • 832.70K Points
Coach

Q. For every non-empty string, the length of the longest palindromic subsequence is at least one.

  • (A) true
  • (B) false
  • (C) ---
  • (D) ---

A

Admin • 832.70K Points
Coach

Q. Recursion is similar to which of the following?

  • (A) switch case
  • (B) loop
  • (C) if-else
  • (D) if elif else

A

Admin • 832.70K Points
Coach

Q. Recursion is a method in which the solution of a problem depends on

  • (A) larger instances of different problems
  • (B) larger instances of the same problem
  • (C) smaller instances of the same problem
  • (D) smaller instances of different problems

A

Admin • 832.70K Points
Coach

Q. Which of the following problems can’t be solved using recursion?

  • (A) factorial of a number
  • (B) nth fibonacci number
  • (C) length of a string
  • (D) problems without base case

A

Admin • 832.70K Points
Coach

Q. In general, which of the following methods isn’t used to find the factorial of a number?

  • (A) recursion
  • (B) iteration
  • (C) ---
  • (D) ---

A

Admin • 832.70K Points
Coach

Q. Which of the following recursive formula can be used to find the factorial of a number?

  • (A) fact(n) = n * fact(n)
  • (B) fact(n) = n * fact(n+1)
  • (C) fact(n) = n * fact(n-1)
  • (D) fact(n) = n * fact(1)