This quiz is designed to help you reinforce your understanding of Python functions. Spanning foundational concepts to advanced applications, the quiz challenges learners to:
Each module explores a distinct topic, offering both theoretical and hands-on coding questions to test your proficiency. Dive in to assess your knowledge and prepare for real-world programming challenges!
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
0 of 16 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 16 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
What keyword is used to define a function in Python?
How do you pass default values to function parameters?
What is the output?
def add(x = 10):
print(str(x + 1))
add(21)
What is the output?
def fun(a, b):
print(type(b))
fun(['a', (10, 20, 30)], 7.7)
What is the output for type(a)
?
def fun(a, b):
print(type(a))
fun(['a', (10, 20, 30)], 7.7)
What is the output?
def fun(a):
def add(b):
return a + b
return add
print(fun(4)(8))
Which function is a classic example of recursion?
What will the following code output?
def factorial(n):
if n == 1:
return 1
return n * factorial(n - 1)
print(factorial(3))
What is a decorator in Python?
Which symbol is used to apply a decorator to a function?
What will the following code output?
def decorator(func):
def wrapper():
print("Hello")
func()
return wrapper
@decorator
def say_name():
print("John")
say_name()
What is a higher-order function?
What is a closure in Python?
What does the following code output?
from functools import lru_cache
@lru_cache(maxsize=None)
def add(a, b):
return a + b
print(add(2, 3))
print(add(2, 3))
What does the staticmethod
decorator do?
Which method type uses @classmethod
?
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_gat | 1 minute | This cookie is installed by Google Universal Analytics to restrain request rate and thus limit the collection of data on high traffic sites. |
Cookie | Duration | Description |
---|---|---|
_ga | 2 years | The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors. |
_gid | 1 day | Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously. |
tk_lr | 1 year | The tk_lr is a referral cookie set by the JetPack plugin on sites using WooCommerce, which analyzes referrer behaviour for Jetpack. |
tk_or | 5 years | The tk_or is a referral cookie set by the JetPack plugin on sites using WooCommerce, which analyzes referrer behaviour for Jetpack. |
tk_r3d | 3 days | JetPack installs this cookie to collect internal metrics for user activity and in turn improve user experience. |
tk_tc | session | JetPack sets this cookie to record details on how user's use the website. |
Cookie | Duration | Description |
---|---|---|
m | 2 years | No description available. |