Function Fundamentals
Arguments & Parameters
Return to Sender
Lambda Logic
Case Study Challenges
100

This keyword is used to define a function in Python.

What is def?

100

In the function definition def greet(name):, name is known as this.

What is a parameter?

100

This keyword is used to send a value back from a function to the caller.

What is return?

100

This wonderfully concise keyword is used to define anonymous functions in Python.

What is lambda?

100

You are designing a billing system. Write a function calculate_total(price, tax) that returns the total cost after adding tax.

What is:

def calculate_total(price, tax):      return price + (price * tax)


200

This value is automatically returned from a function if no return statement is used.

What is None?

200

In the function call greet("Alice"), "Alice" is this type of value.

What is an argument?

200

What is the return value of a function that has no return statement?

What is None?

200

This is the output of the code:

x = lambda a: a * 2  print(x(3))  


What is `6`?

200

A Python developer is designing a quiz app. Why is it beneficial to separate question display, user input, and answer checking into separate functions?

What is to improve modularity, readability, and reuse of code?

300

This function definition contains a syntax error: def hello: print("Hi"). Identify the mistake.

What is missing parentheses after hello?

300

This type of argument is used when a default value is assigned in the function definition. Example: def greet(name="Guest")

What is a default argument?

300

Consider this function:

def add(x, y):      return x + y  


What is the output of print(add(2, 3))?

300

Fill in the blank to create a lambda that adds two numbers:  

`lambda x, y: ____` 

What is `x + y`?

300

You're tasked with optimizing a hospital’s appointment system. The team has written a single 100-line function that handles input, validation, scheduling, and messaging. What is a better design approach and why?

What is to break the large function into smaller, single-responsibility functions to follow clean code and modular programming principles?

400

This is how you define a function named square that returns the square of its input n.

What is def square(n): return n * n?

400

Identify the output of this code:


def show(a, b=2):      print(a + b)  show(3)  


What is `5`?

400

What will be the output of the following code?


def f():      return 1, 2, 3  print(f())


What is `(1, 2, 3)` (a tuple)?

400

Analyze and explain the output:


nums = [1, 2, 3, 4]  doubled = list(map(lambda x: x*2, nums))  print(doubled)  


What is `[2, 4, 6, 8]`?

400

A company is reviewing two function implementations for sorting product reviews: one with recursion and one with built-in sort(). As a software reviewer, how would you evaluate which to keep in production?

What is to evaluate based on efficiency, readability, maintainability, and appropriateness for the data size and context?

M
e
n
u