Module Basics

Qus. 1 : Which statement is correct to import all modules from the package ?

  1. From package import all
  2. From package import *
  3. From package include all
  4. From package include *
Qus. 2 : A Python module is a file with the __________ file extension that contains valid Python code.

  1. .pym
  2. .pymodule
  3. module
  4. .py
Qus. 3 : Which of the following is the basic I/O connections in file ?

  1. Standard Input
  2. Standard Output
  3. Standard Errors
  4. All of the mentioned
Qus. 4 : <p>What will be the output of the following?</p><pre><span style="font-size: 14px;">import sys<br></span><span style="font-size: 14px;">sys.stdout.write('welcome\n')<br></span><span style="font-size: 14px;">sys.stdout.write('all\n')&nbsp;&nbsp;</span></pre>

  1. Welcome<br/> All
  2. Welcome All
  3. Compilation Error
  4. Runtime Error
Qus. 5 : To use a module in another module, you must import it using an, statement

  1. import
  2. include
  3. both (A) and (B)
  4. none of the above
Qus. 6 : A stores information in the form of a stream of ASCII or unicode characters i.e. human readable.

  1. Text file
  2. Binary file
  3. Both (A) and (B)
  4. None of these
Qus. 7 : Which operator is used in Python to import modules from packages?

  1. .
  2. *
  3. ->
  4. &
Qus. 8 : Modules are files saved with _____ extension.

  1. .module
  2. .py
  3. both a & b
  4. All of the above
Qus. 9 : This imports * statement import all in the modules except those beginning with ____ .

  1. _
  2. &
  3. %
  4. None of the above
Qus. 10 : Which of these definitions correctly describes a module?

  1. Denoted by triple quotes for providing the specification of certain program elements
  2. Design and implementation of specific functionality to be incorporated into a program
  3. Defines the specification of how it is to be used
  4. Any program that reuses code
Qus. 11 : <p>What will be the output of the following Code ?</p><pre><span style="font-size: 14px;">x=10, y=3<br></span><span style="font-size: 14px;">print(divmod(x,y))</span></pre>

  1. (3,1)
  2. (4,2)
  3. (5,7)
  4. (1,3)
Qus. 12 : os.getlogin() function return?

  1. Return the name of the user logged in to the terminal
  2. Return the email of the user logged in to the terminal
  3. Return the login time when user logged in to the terminal
  4. None of the above
Qus. 13 : Extension of python module is

  1. .mod
  2. .module
  3. .py
  4. .python

Programs

python program to generate 3 random integers between 100 and 999 which is divisible by 5

View Solution


python program to generate 6 digit random secure OTP between 100000 to 999999

View Solution


python program to generate 6 random numbers and then print their mean median and mode

View Solution


python program to print the calendar of given month and year

View Solution


python program to print the calendar of given year

View Solution


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad