Completed
Arguments & Parameters
Questions From This Challenge
Q1mcq1 mark
What is a default parameter in a function?
A parameter that must be passed every time the function is called
A parameter that takes a pre-assigned value if no argument is passed for it ✓
A parameter that can only accept numbers
A parameter that is automatically deleted after the function runs
Q2mcq1 mark
In the function definition def greet(name, message="Hi"):, which parameter is the default parameter?
name
message ✓
both name and message
neither
Q3mcq1 mark
What happens in positional argument passing?
Arguments are matched to parameters by their name
Arguments are matched to parameters in the order they are passed ✓
Arguments can be passed in any order
Only one argument can be passed at a time
Q4mcq1 mark
Consider def power(base, exponent=2):. In the call power(5), what value does exponent take?
5
2 ✓
0
None
Q5mcq1 mark
Which of these calls correctly passes 3 and 4 as positional arguments to def add(a, b):?
add(3, 4) ✓
add(4, 3, 5)
add()
add(3)
Q6mcq1 mark
What is the correct term for the values passed inside the parentheses when calling a function, such as "Riya" in greet("Riya")?
parameters
arguments ✓
variables
constants
Q7mcq1 mark
Given def info(city, country="India"):, which call will result in country having the value "India"?
info("Delhi") ✓
info("Delhi", "USA")
info("Delhi", "France")
info("Delhi", "Nepal")
Q8mcq1 mark
What is the maximum number of default parameters a function can have in Python?
Only one
No fixed limit — a function can have multiple default parameters ✓
Exactly two
Default parameters are not allowed in Python
Q9output1 mark
What is the output?
def greet(name, greeting="Hello"):
print(greeting, name)
greet("Meera")
greet("Kabir", "Hi")
Correct output:
Hello Meera
Hi KabirQ10output1 mark
What is the output?
def compute(a, b=10):
print(a + b)
compute(5)
compute(5, 20)
Correct output:
15
25Q11output1 mark
What is the output?
def show_info(name, age=18):
print(name, "is", age, "years old")
show_info("Zara", 21)
show_info("Dev")
Correct output:
Zara is 21 years old
Dev is 18 years oldQ12output1 mark
What is the output?
def multiply(x, y=3):
result = x * y
print(result)
multiply(4)
multiply(4, 5)
Correct output:
12
20Q13output1 mark
What is the output?
def label(item, tag="General"):
print(item + " - " + tag)
label("Book")
label("Pen", "Stationery")
Correct output:
Book - General
Pen - StationeryQ14output1 mark
What is the output?
def total_marks(m1, m2, m3=0):
print(m1 + m2 + m3)
total_marks(50, 60)
total_marks(50, 60, 70)
Correct output:
110
180Q15output1 mark
What is the output?
def describe(city, state="Unknown", country="India"):
print(city, state, country)
describe("Jaipur", "Rajasthan")
Correct output:
Jaipur Rajasthan India