Header Ads Widget

Responsive Advertisement

Python Programming Week 11 Quiz Solution [Python Programming course on Prouor.ai by IIT kharagpur]

 Here you will get all the assignment and quiz solutions of Python Programming Course by prutor.ai. Prutor is an online smart tutoring platform which provides various MOOC courses for student and organised by by IIT Kharagpur. At the end of each course student gets a certificate for sucessfull  completion of each course but throughout the course students have to pass all the weekly assignments and quizes.

[1]  In general, any recursive procedure can be expressed as an equivalent non-recursive procedure.

  • (a): True
  • (b): False

Answer: (a) True

[2] Suppose we want to write an algorithm to compute f(n) where f(n) = f(n-1) + f(n-2) and f(0) = 0, f(1) = 1. Which one of the following is true about this algorithm –

  • (a): This recursive algorithm is more efficient than the best iterative algorithm.
  • (b): This recursive algorithm and the best iterative algorithm are equally efficient
  • (c): This recursive algorithm is less efficient than the best iterative algorithm
  • (d): Nothing can be said about the relative efficiency of this recursive algorithm and the best iterative algorithms

Answer: (c) This recursive algorithm is less efficient than the best iterative algorithm

[3] Suppose we want to write an algorithm to compute factorial(n) where n>=0 and f(0) = 1. Which one of the following is true about this algorithm –

  • (a): This recursive algorithm is more efficient than the best iterative algorithm.
  • (b): This recursive algorithm and the best iterative algorithm are equally efficient
  • (c): This recursive algorithm is less efficient than the best iterative algorithm
  • (d): Nothing can be said about relative efficiency of this recursive algorithm and the best iterative algorithms

Answer: (b) This recursive algorithm and the best iterative algorithm are equally efficient.

[4] We should always use a recursive algorithm instead of its equivalent iterative algorithm to solve a problem because a recursive algorithm is easier to implement than equivalent iterative algorithm.

  • (a): True
  • (b): False

Answer: (b) False

[5] Which of the following is not true about Tower of Hanoi puzzle –

  • (a): puzzle consists of three rods
  • (b): Disks in a rod are kept as a stack with largest disk at the top
  • (c): Only one disk can be moved at a time
  • (d): A disk can only be moved if it is the uppermost disk on a stack

Answer: (b) Disks in a rod are kept as a stack with largest disk at the top




[6] If there are two disks initially in Tower of Hanoi puzzle then number of disk movements required to solve the puzzle will be –

  • (a): 1
  • (b): 2
  • (c): 3
  • (d): 4

Answer: (c) 3

[7] If n is the number of disks in Tower of Hanoi puzzle and T(n) is the required number of disk movements to solve the puzzle then –

  • (a): T(n) = T(n-1) + 1
  • (b): T(n) = 2*T(n-1) + 1
  • (c): T(n) = 3*T(n-1) + 1
  • (d): T(n) = T(n-1) – 1

Answer: (b) T(n) = 2*T(n-1) + 1


[8] To solve Tower of Hanoi puzzle, which one of the following is true –

  • (a): A recursive algorithm is more efficient than an iterative algorithm
  • (b): Any recursive algorithm and any iterative algorithm are equally efficient
  • (c): A recursive algorithm is less efficient than an iterative algorithm
  • (d): Nothing can be said about relative efficiency of recursive and iterative algorithms

Answer: (b) Any recursive algorithm and any iterative algorithm are equally efficient

[9] If there are four disks initially in Tower of Hanoi puzzle then number of disk movements required to solve the puzzle will be –

  • (a): 13
  • (b): 14
  • (c): 15
  • (d): 16

Answer: (c) 15

[10] Sorting problem is to search a key in the given sorted sequence.

  • (a): True
  • (b): False

Answer: (b) False




[11] An example of a sorting problem is to arrange a given integer-sequence in increasing order.

  • (a): True
  • (b): False

Answer: (a) True


[12] What is easy to do in a sorted list –

  • (a): Searching a key
  • (b): Rank query
  • (c): Quantile query
  • (d): All

Answer: (d) All

[13] There is only one algorithm to solve sorting problem.

  • (a): True
  • (b): False

Answer: (b) False

[14] An English dictionary can be termed as a sorted list of strings over English alphabet.

  • (a): True
  • (b): False

Answer: (a) True

[15] Why are local variable names beginning with an underscore discouraged in python –

  • (a): They are used to indicate the private variables of a class
  • (b): They confuse the interpreter
  • (c): They are used to indicate global variables
  • (d): They slow down execution




Answer: (a) They are used to indicate the private variables of a class


If you have any quetions, please comment down below, we will try to answer with in first 24 hour. Hope you liked this content, We will come with another week’s quiz, Thanks for reading. Good Bye.

Post a Comment

0 Comments