Test Series - python

Test Number 63/108

Q: Which of the following is the use of function in python?
A. Functions are reusable pieces of programs
B. Functions don’t provide better modularity for your application
C. you can’t also create your own functions
D. All of the mentioned
Solution: Functions are reusable pieces of programs. They allow you to give a name to a block of statements, allowing you to run that block using the specified name anywhere in your program and any number of times.
Q: Which keyword is used for function?
A. Fun
B. Define
C. Def
D. Function
Solution: None.
Q: Which of the following is a feature of DocString?
A. Provide a convenient way of associating documentation with Python modules, functions, classes, and methods
B. All functions should have a docstring
C. Docstrings can be accessed by the __doc__ attribute on objects
D. All of the mentioned
Solution: Python has a nifty feature called documentation strings, usually referred to by its shorter name docstrings. DocStrings are an important tool that you should make use of since it helps to document the program better and makes it easier to understand.

You Have Score    /3