Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

How do you define a function in Python?
A. function my_function():
B. func my_function():
C. define my_function():
D. def my_function():
Direction: Choose the correct option

Q2.

What is the purpose of the `return` statement?
A. To loop
B. To exit a function and optionally return a value
C. To define a function
D. To print a value
Direction: Choose the correct option

Q3.

What is the output of `def add(a,b): return a+b; print(add(2,3))`?
A. Error
C. 5
D. 2,3
Direction: Choose the correct option

Q4.

What is a default argument?
A. A keyword argument
B. An argument that has a default value if not provided
C. A variable-length argument
D. An argument that must be provided
Direction: Choose the correct option

Q5.

What does `def func(*args):` do?
A. Accepts keyword arguments
B. Accepts variable number of positional arguments
C. Returns a tuple
D. Defines a default argument
Direction: Choose the correct option

Q6.

What does `def func(**kwargs):` do?
A. Accepts positional arguments
B. Accepts a dictionary
C. Accepts variable number of keyword arguments
D. Returns a dictionary
Direction: Choose the correct option

Q7.

How do you call a function with keyword arguments?
A. func(1,2)
B. func({a:1,b:2})
C. func([1,2])
D. func(a=1, b=2)
Direction: Choose the correct option

Q8.

What is the scope of a variable defined inside a function?
A. Built-in
B. Local to the function
C. Global
D. Enclosing function
Direction: Choose the correct option

Q9.

What is the output of `def func(): return; print(func())`?
C. Error
Direction: Choose the correct option

Q10.

What is a lambda function?
A. An anonymous function
B. A named function
C. A recursive function
D. A built-in function