Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is the output of this code? def func(x, y=2): return x * y; print(func(3))

View

What is the result of this code? def func(x, y): return x - y; print(func(5, y=2))

View

What is a function that calls itself known as?

View

What is the output of this code? def f(x): if x == 1: return 1; else: return x + f(x - 1); print(f(3))

View

Which of the following is a correct way to pass keyword arguments to a function?

View

What is the default return value of a function that does not specify a return statement?

View

What is the output of this code? def greet(name="Guest"): print("Hello", name); greet()

View

What is the purpose of the *args parameter in a function?

View

What will be the output of this code? def func(x, y=10): return x + y; print(func(5, y=15))

View

Which of the following is true about recursion?

View

What is the output of this code? def func(x, y=2): return x * y; print(func(3))

6
3
2
Error

What is the result of this code? def func(x, y): return x - y; print(func(5, y=2))

3
Error
7
None

What is a function that calls itself known as?

Recursive function
Lambda function
Generator
Method

What is the output of this code? def f(x): if x == 1: return 1; else: return x + f(x - 1); print(f(3))

6
5
3
Error

Which of the following is a correct way to pass keyword arguments to a function?

func(5, y=2)
func(5, 2)
func(x=5, y)
func(x: 5, y=2)

What is the default return value of a function that does not specify a return statement?

None
0
False
Error

What is the output of this code? def greet(name="Guest"): print("Hello", name); greet()

Hello Guest
Hello
Error
None

What is the purpose of the *args parameter in a function?

To pass a list of arguments
To accept any number of positional arguments
To define default values
To return a tuple

What will be the output of this code? def func(x, y=10): return x + y; print(func(5, y=15))

20
15
5
10

Which of the following is true about recursion?

Recursion occurs when a function calls another function.
A recursive function must have a base case to avoid infinite loops.
Recursive functions cannot return values.
Recursion is not supported in Python.