62 solutions available
Question 1Assertion. The documentation for a Python module should be written in triple-quoted strings.Reason. The docstrings are triple-quoted...
Question 2Assertion. After importing a module through import statement, all its function definitions, variables, constants etc. are made available in...
Question 3Assertion. If an item is imported through from <module> import <item> statement then you do not use the module name along with...
Question 4Assertion. Python's built-in functions, which are part of the standard Python library, can directly be used without specifying their module...
Question 5Assertion. Python offers two statements to import items into the current program : import and from <module> import, which work...
Question 1Which operator is used in Python to import all modules from packages ?. operator* operator-> symbol, operator
Question 2Which file must be part of the folder containing Python module files to make it importable Python package...
Question 3In Python which is the correct method to load a module math ?include mathimport math#include<math.h>using math
Question 4Which is the correct command to load just the tempc method from a module called usable ?import usable, tempcimport tempc from usablefrom...
Question 5What is the extension of Python library modules ?.mod.lib.code.py
Question 1The file __init__.py must be the part of the folder holding library files and other definitions in order to be treated as importable...
Question 2A library refers to a collection of modules that together cater to specific type of needs or applications.
Question 3A Python module is a file (.py file) containing variables, class definitions, statements and functions related to a particular task.
Question 4The uniform() function is the part of random module.
Question 5The capwords() function is the part of string module.
Question 1A .py file containing constants/variables, classes, functions etc. related to a particular task and can be used in other programs is...
Question 2The collection of modules and packages that together cater to a specific type of applications or requirements, is called...
Question 3An independent triple quoted string given inside a module, containing documentation related information is a ...............Documentation...
Question 4The help <module> statement displays ............... from a module.constantsfunctionsclassesdocstrings
Question 5Which command(s) modifies the current namespace with the imported object name ?import <module>import <module1>,...
Question 6Which command(s) creates a separate namespace for each of the imported module ?import <module>import <module1>,...
Question 7Which of the following random module functions generates a floating point number ?random()randint()uniform()all of these
Question 8Which of the following random module functions generates an integer ?random()randint()uniform()all of these
Question 9Which file must be a part of a folder to be used as a Python package ?package.py__init__.py__package__.py__module__.py
Question 10A python module has ............... extension..mod.imp.py.mpy
Question 11Which of the following is not a function/method of the random module in Python ?randfloat()randint()random()randrange()
Question 1A Python program and a Python module means the same.
Question 2A Python program and a Python module have the same .py file extension.
Question 3The import <module> statement imports everything in the current namespace of the Python program.
Question 4Any folder having .py files is a Python package.
Question 5A folder having .py files along with a special file i.e, __init__.py in it is an importable Python package.
Question 6The statement from <module> import <objects> is used to import a module in full.
Question 1What is the significance of Modules ?
Question 2What are docstrings ? What is their significance ? Give example to support your answer.
Question 3What is a package ? How is a package different from module ?
Question 4What is a library ? Write procedure to create own library in Python.
Question 5What is the use of file __init__.py in a package even when it is empty ?
Question 6What is the importance of site-packages folder of Python installation ?
Question 7How are following import statements different ?(a) import X(b) from X import *(c) from X import a, b, c
Question 8What is Python PATH variable ? What is its significance ?
Question 9In which order Python looks for the function/module names used by you.
Question 10What is the usage of help( ) and dir( ) functions.
Question 11Name the Python Library modules which need to be imported to invoke the following functions :(i) log()(ii) pow()(iii) cos(iv) randint(v)...
Question 12What is dot notation of referring to objects inside a module ?
Question 13Why should the from <module> import <object> statement be avoided to import objects ?
Question 14What do you understand by standard library of Python ?
Question 15Explain the difference between import <module> and from <module> import statements, with examples.
Question 1Create module tempConversion.py as given in Fig. 4.2 in the chapter. If you invoke the module with two different types of import...
Question 2A function checkMain() defined in module Allchecks.py is being used in two different programs. In program 1 as Allchecks.checkMain(3, 'A')...
Question 3Given below is semi-complete code of a module basic.py :# """...............""" def square(x): """...............""" return mul(x, x)...
Question 4After importing the above module, some of its functions are executed as per following statements. Find errors, if any:(a) square(print...
Question 5Import the above module basic.py and write statements for the following :(a) Compute square of 19.23.(b) Compute floor division of 1000.01...
Question 6Suppose that after we import the random module, we define the following function called diff in a Python session :def diff(): x =...
Question 7What are the possible outcome(s) executed from the following code? Also specify the maximum and minimum values that can be assigned to...
Question 8Consider the following code :import random print(int(20 + random.random() * 5), end = ' ') print(int(20 + random.random() * 5), end = ' ')...
Question 9Consider the following code :import random print(100 + random.randint(5, 10), end = ' ' ) print(100 + random.randint(5, 10), end = ' ' )...
Question 10Consider the following packagemusic/ Top-level package ├── __init__.py ├── formats/ Subpackage...
Question 11What are the possible outcome(s) executed from the following code ? Also specify the maximum and minimum values that can be assigned to...
Question 1Write a Python program having following functions :A function with the following signature : remove_letter(sentence, letter)This function...
Question 2Create a module lengthconversion.py that stores functions for various lengths conversion e.g.,miletokm() — to convert miles to...
Question 3Create a module MassConversion.py that stores function for mass conversion e.g.,1.kgtotonne() — to convert kg to tonnes2. tonnetokg() — to...
Question 4Create a package from above two modules as this :Conversion ├──Length │ └──Lengthconversion.py └──Mass...