Important Questions Introducing Python Modules Class 11 Informatics Practices

Important Questions Introducing Python Modules Class 11 Informatics Practices

Important Questions Class 11

Please refer to Important Questions Introducing Python Modules Class 11 Informatics Practices below. These questions and answers have been prepared based on the latest examination guidelines and NCERT book issued for Class 11 Informatics Practices for the current academic year. We have provided Important Questions for Class 11 Informatics Practices for all chapters here. Introducing Python Modules is an important chapter in Class 11 Informatics Practices, following Important Questions and their solutions will help you to get more marks in examinations.

Introducing Python Modules Class 11 Informatics Practices Important Questions

Very Short Answer Type Questions

Q.1 Write a python code to import math module.
Ans:
import math

Q.2 How can the function sqrt() be used in Python?
Ans:
from math import sqrt (importing a single object from a module)

Q.3 find the error in the following code –

Short Answer Type Questions


Q.1 What is the significance of modules?
Ans:
The process of breaking a bigger unit into individual components (modules) is called modularity. Modularity reduces complexity to some degree.

Q.2 What are docstrings? What is their significance? Give example to support your answer.
Ans:
docstrings are triple quoted comments which are useful for documentation purposes. A docstring should be the first string stored inside a module/function-body/class.
For ex-
“ ” ” Conversion function between Fahrenheit and centigrade” ” ”

Q.3 What is dot notation of referring to objects inside a module?
Ans:
After importing a module, to access one of the functions, we have to specify the name of the module and name of the function, separated by a dot. This format is called dot notation.

Q.4 Why should the from import statement be avoided to import objects?
Ans:
If your program already has a variable with the same name as the one imported via module, then the variable in your program will hide imported member with same name because there cannot be two variables with the same name in one namespace.

Q.5 What do you understand by standard library of Python?
Ans:
Python library is a collection of functions and methods that allows you to perform many actions.

Q.6 Explain the difference between import and from import statements, with examples.
Ans:
import will import the whole module in the program whereas from import will import only asked functions and variables from the module.
For ex-
Import time
From math import sqrt, pow

Q.7 What is a function? How is it useful?
Ans:
A function is a named block in a program which has some certain working. Whenever you call this it performs all its working. It reduces the complexity and reduces the labour of writing same code again and again.

Q.8 What is an argument? Give an example of one.
Ans:
An argument is the requirement of a function to perform its working. For ex-
pow(x,y), here x and y are the arguments which are required to pass to pow() for its working.

Important Questions Introducing Python Modules Class 11 Informatics Practices