QUESTION IMAGE
Question
question 24/30
¿cuáles de los siguientes enunciados son verdaderos?
(seleccione dos respuestas.)
cada función debe devolver antes de ser invocada.
el valor default de una función es el mismo nombre.
una función está obligada a devolver un valor.
una función puede invocarse a sí misma.
To solve this, we analyze each statement about functions (in programming or mathematics):
- "Cada función debe definirse antes de ser invocada" (Every function must be defined before being called): True. In most programming languages (and in mathematical function usage), you need to define a function (specify its code/logic) before you can call (invoke) it.
- "Es posible definir más de una función con el mismo nombre" (It is possible to define more than one function with the same name): True (overloading). In languages like Python (with decorators/overloading libraries), Java, C++, you can have multiple functions with the same name but different parameters (parameter overloading).
- "Una función está obligada a devolver un valor" (A function is obliged to return a value): False. For example, in Python, a function can be a "void" function (e.g.,
def print_hello(): print("Hello")), which returnsNoneimplicitly but does not have a required return value.
- "Una función puede invocarse a sí misma" (A function can call itself): True (recursion). Functions can call themselves (e.g., factorial calculation:
def fact(n): return 1 if n == 0 else n * fact(n-1)).
So the true statements are:
- Cada función debe definirse antes de ser invocada
- Es posible definir más de una función con el mismo nombre
- Una función puede invocarse a sí misma
(The statement "Una función está obligada a devolver un valor" is false.)
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
To solve this, we analyze each statement about functions (in programming or mathematics):
- "Cada función debe definirse antes de ser invocada" (Every function must be defined before being called): True. In most programming languages (and in mathematical function usage), you need to define a function (specify its code/logic) before you can call (invoke) it.
- "Es posible definir más de una función con el mismo nombre" (It is possible to define more than one function with the same name): True (overloading). In languages like Python (with decorators/overloading libraries), Java, C++, you can have multiple functions with the same name but different parameters (parameter overloading).
- "Una función está obligada a devolver un valor" (A function is obliged to return a value): False. For example, in Python, a function can be a "void" function (e.g.,
def print_hello(): print("Hello")), which returnsNoneimplicitly but does not have a required return value.
- "Una función puede invocarse a sí misma" (A function can call itself): True (recursion). Functions can call themselves (e.g., factorial calculation:
def fact(n): return 1 if n == 0 else n * fact(n-1)).
So the true statements are:
- Cada función debe definirse antes de ser invocada
- Es posible definir más de una función con el mismo nombre
- Una función puede invocarse a sí misma
(The statement "Una función está obligada a devolver un valor" is false.)