Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer
Q. Which is the most appropriate definition for recursion?
a. a function that calls itself
b. a function execution instance that calls another execution instance of the same function
c. a class method that calls another class method
d. an in-built method that is automatically called
Q. Which of these is false about recursion?
a. recursive function can be replaced by a non-recursive function
b. recursive functions usually take more memory space than non-recursive function
c. recursive functions run faster than non- recursive function
d. recursion makes programs easier to understand
Q. What is tail recursion?
a. a recursive function that has two base cases
b. a function where the recursive functions leads to an infinite loop
c. a recursive function where the function doesn’t return anything and just prints the values
d. a function where the recursive call is the last thing executed by the function
Q. , tot-2)
a. both a() and b() aren’t tail recursive
b. both a() and b() are tail recursive
c. b() is tail recursive but a() isn’t
d. a() is tail recursive but b() isn’t
Q. Which of the following statements is false about recursion?
a. every recursive function must have a base case
b. infinite recursion can occur if the base case isn’t properly mentioned
c. a recursive function makes the code easier to understand
d. every recursive function must have a return value
Q. What happens if the base condition isn’t defined in recursive programs?
a. program gets into an infinite loop
b. program runs once
c. program runs n number of times where n is the argument given to the function
d. an exception is thrown
Q. Which of these is not true about recursion?
a. making the code look clean
b. a complex task can be broken into sub- problems
c. recursive calls take up less memory
d. sequence generation is easier than a nested iteration
Q. Which of these is not true about recursion?
a. it’s easier to code some real-world problems using recursion than non-recursive equivalent
b. recursive functions are easy to debug
c. recursive calls take up a lot of memory
d. programs using recursion take longer time than their non-recursive equivalent
Q. Which of the following commands will create a list?
a. list1 = list()
b. list1 = []
c. list1 = list([1, 2, 3])
d. all of the mentioned
Q. What is the output when we execute list(“hello”)?
a. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
b. [‘hello’]
c. [‘llo’]
d. [‘olleh’]