Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 12, Problem 1MC
Program Description Answer

A function which calls itself is called as recursion.

Hence, the correct answer is option “C”.

Expert Solution & Answer
Check Mark

Explanation of Solution

Recursion:

Recursion is a process where function is called again and again by itself for a specific number of times.

  • There are two types of recursive functions. They are as follows:
    • Direct recursion
    • Indirect recursion

Direct recursion:

When a function calls the same function repeatedly until the condition becomes false, then it is called as direct recursion.

Indirect recursion:

When a function calls another function which in turn calls the same calling function, then it is called as indirect recursion.

Example:

Consider the following example; the function “Add()” can be called itself in the same function definition. Hence, it comes under direct recursion.

#Define the Add()function

def Add()

         #Print the message

         print('Example of recursive function!!')

         #Call the Add() function recursively

         Add()

Explanation for wrong options:

A recursive function cannot call the different function.

Hence, option “A” is wrong.

A recursive function cannot halt the program.

Hence, option “B” is wrong.

A recursive function can call more than once in a program.

Hence, option “D” is wrong.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!

Chapter 12 Solutions

Starting Out with Python (4th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education