Python 3 MCQ (SET-8) – Multiple Choice Questions and Answers

  1. What is the name of Python’s built-in module for mathematical statistics
    functions?
    a. mathstats
    b. statistics
    c. statmath
    d. statfunc
  2. What is the name of Python’s built-in module for subprocess management?
    a. sub
    b. mansub
    b. mansub
    c. submng
    d. subprocess
  3. What is the name of Python’s built-in module for Python’s configuration
    information?
    a. config
    b. pysys
    c. sysconfig
    d. pycon
  4. What is the name of Python’s built-in module for telnet client class?
    a. telnetlib
    b. tellib
    c. tnet
    d. telnet
  5. What is the name of Python’s built-in module for generating temporary files
    and directories?
    a. temp
    b. tempdir
    c. temporary
    d. tempfile
  6. What is the name of Python’s built-in module for thread based parallelism?
    a. thread
    b. threadall
    c. threading
    d. thrpar
  7. What is the name of Python’s built-in module for time access and
    conversions?
    a. timely
    b. time
    c. primetime
    d. mytime
  8. What is the name of Python’s built-in module for working with calendars?
    a. calendars
    b. calendar
    c. yearcal
    d. calc
  9. What is the name of Python’s built-in module for measuring execution time
    of code snippets?
    a. timeit
    b. selftime
    c. codetime
    d. timer
  10. What is the name of Python’s built-in module for interface to Tcl/Tk for
    graphical user interfaces?
    a. tkgui
    b. guitk
    c. intertk
    d. tkinter
  11. What is the name of Python’s built-in module for simple educational
    graphical applications?
    a. torque
    b. tedu
    c. turtle
    c. turtle
    d. moveturtle
  12. What is the name of Python’s built-in module for url handling?
    a. urls
    b. urllib
    c. URL
    d. httpurl
  13. What is the name of Python’s built-in module for interface to WAV sound
    format?
    a. wav
    b. WAVE
    c. WAV
    d. wave
  14. What is the name of Python’s built-in module for web browser controlller?
    a. browser
    b. browse
    c. webrowser
    d. webbrowser
  15. What is the name of Python’s built-in module for xml processing?
    a. xml
    b. XML
    c. allxml
    d. onlyxml
  16. What is the name of Python’s built-in module for reading and writing ZIP
    archive files?
    a. readzip
    b. zipfile
    c. writezip
    d. rwzip
  17. What is the name of Python’s built-in module for running Python scripts via
    CGI?
    a. pcgi
    b. pycgi
    c. cgi
    d. cgipy
  18. What is the name of Python’s built-in module for mathematical functions
    for complex numbers?
    a. complexmath
    b. cmath
    c. mathc
    d. mathplex
  19. What is the name of Python’s built-in module for conversions between color
    systems?
    a. color
    b. colors
    c. colours
    d. colorsys
  20. What is the name of Python’s built-in module for shallow and deep copy
    operations?
    a. copyd
    b. copyme
    c. copy
    d. copys
  21. What is the name of Python’s built-in module for comparing files?
    a. filecmp
    b. cmpfile
    c. compare
    d. filecompare
  22. What is the name of Python’s built-in module for FTP protocol client?
    a. ftp
    b. ftplib
    c. FTP
    d. pftp
  23. What is the name of Python’s built-in module for unix style pathname
    pattern expansion?
    a. upattern
    b. pathpat
    c. upath
    d. glob
  24. What is the name of Python’s built-in module for html manipulation?
    a. hyper
    b. xml
    c. html
    d. uml
  25. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    x.clear()
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [0]
    c. []
    d. [1, 2, 3, 4, 5]
  26. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    y = x.copy()
    print(y)
    a. [0, 1, 2, 3, 4, 5]
    b. [5, 4, 3, 2, 1]
    c. []
    d. [1, 2, 3, 4, 5]
  27. What will be the output after the following statements?
    x = []
    for i in range(10):
    x.append(i**2)
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
    c. [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
    d. [1, 4, 9, 16, 25, 36, 49, 64, 81]
  28. What will be the output after the following statements?
    x = list(map(lambda x:x**2, range(5)))
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [1, 4, 9, 16, 25]
    c. [0, 1, 4, 9, 16, 25]
    d. [0, 1, 4, 9, 16]
  29. What will be the output after the following statements?
    x = [i**2 for i in range(4)]
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [1, 4, 9]
    c. [0, 1, 4, 9]
    d. [0, 1, 4, 9, 16]
  30. What will be the output after the following statements?
    a = [(x, y) for x in [0, 1, 2] for y in [3, 4, 5] if x!=y]
    print(a)
    a. [0, 1, 2, 3, 4, 5]
    b. [(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
    c. [(0, 1, 2), (3, 4, 5)]
    d. [(0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
  31. What will be the output after the following statements?
    a = [(x, y) for x in [0, 3, 5] for y in [5, 4, 0] if x!=y]
    print(a)
    a. [(0, 5), (0, 4), (3, 5), (3, 4), (3, 0), (5, 4), (5, 0)]
    b. [(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
    c. [(0, 3, 5), (0, 4, 5)]
    d. [(0, 5), (0, 4), (0, 0), (3, 5), (3, 4), (3, 0), (5, 5), (5, 4), (5, 0)]
  32. What will be the output after the following statements?
    a = [(x, y) for x in [0, 2] for y in [2, 4, 0] if x==y]
    print(a)
    a. [(0, 2)]
    b. [(0, 0), (2, 2)]
    c. [(0, 2), (2, 4, 0)]
    d. [(0, 2), (0, 4), (0, 0), (2, 2), (2, 4), (2, 0)]
  33. What will be the output after the following statements?
    a = [(x, y) for x in [0, 2] for y in [2, 4, 0] if x!=y]
    print(a)
    a. [(0, 2)]
    b. [(0, 0), (2, 2)]
    c. [(0, 2), (0, 4), (2, 4), (2, 0)]
    d. [(0, 2), (0, 4), (0, 0), (2, 2), (2, 4), (2, 0)]
  34. What will be the output after the following statements?
    a = []
    for x in [0, 1, 2]:
    for y in [3, 4, 5]:
    if x!=y:
    a.append((x,y))
    print(a)
    a. [0, 1, 2, 3, 4, 5]
    b. [(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
    c. [(0, 1, 2), (3, 4, 5)]
    d. [(0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
  35. What will be the output after the following statements?
    a = [-2, -1, 0, 1, 2]
    print([i**3 for i in a])
    a. [(0, 2)]
    b. [-2, -1, 0, 1, 2]
    c. [8, 1, 0, 1, 8]
    d. [-8, -1, 0, 1, 8]
  36. What will be the output after the following statements?
    a = [-3, -1, 0, 1, 3]
    print([i**4 for i in a])
    a. [81, 1, 0, 1, 81]
    b. [-81, -1, 0, 1, 81]
    c. [16, 1, 0, 1, 16]
    d. [-16, -1, 0, 1, 16]
  37. What will be the output after the following statements?
    a = [-3, -1, 0, 1, 3]
    print([x for x in a if x>=0])
    a. [-3, -1, 0, 1, 3]
    b. [0, 1, 3]
    c. [1, 3]
    d. [-1, 0, 1]
  38. What will be the output after the following statements?
    a = [-3, -1, 0, 1, 3]
    print([abs(x) for x in a])
    a. [-3, -1, 0, 1, 3]
    b. [0, 1, 3]
    c. [3, 1, 0, 1, 3]
    d. [-1, 0, 1]
  39. What will be the output after the following statements?
    a = [‘ today’, ‘ tomorrow ‘, ‘not now’]
    print([x.strip() for x in a])
    a. [‘today’, ‘tomorrow ‘, ‘not now’]
    b. [‘ today’, ‘ tomorrow’, ‘not now’]
    c. [‘today’, ‘tomorrow’, ‘notnow’]
    d. [‘today’, ‘tomorrow’, ‘not now’]
  40. What will be the output after the following statements?
    print([(x, x*2) for x in range(4)])
    a. [(0, 0), (1, 2), (2, 4), (3, 6)]
    b. [(0, 0), (1, 2), (2, 4), (3, 6), (4, 8)]
    c. [(1, 2), (2, 4), (3, 6), (4, 8)]
    d. [(1, 2), (2, 4), (3, 6)]
  41. What will be the output after the following statements?
    a = [[0, 1, 2], [7, 8, 9], [4, 5, 6]]
    print([x for y in a for x in y])
    a. [0, 1, 2, 4, 5, 6, 7, 8, 9]
    b. [0, 1, 2, 7, 8, 9, 4, 5, 6]
    c. [(0, 1, 2), (7, 8, 9), (4, 5, 6)]
    d. [(0, 7, 4), (1, 8, 5), (2, 9, 6)]
  42. What will be the output after the following statements?
    from math import pi
    a = [str(round(pi, i)) for i in range(0,5)]
    print(a)
    a. [3.0, 3.1, 3.14, 3.142, 3.1416]
    b. [‘3.0’, ‘3.1’, ‘3.14’, ‘3.142’]
    c. [‘3.0’, ‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’]
    d. [‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’]
  43. What will be the output after the following statements?
    a = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
    b = [[x[i] for x in a] for i in range(4)]
    print(b)
    a. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
    b. [[0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11]]
    c. [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
    d. [0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]
  44. What will be the output after the following statements?
    a = []
    b = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
    for i in range(4):
    a.append([row[i] for row in b])
    print(a)
    a. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
    b. [[0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11]]
    c. [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
    d. [0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]
  45. What will be the output after the following statements?
    a = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
    print(list(zip(*a)))
    a. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
    b. [[0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11]]
    c. [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
    d. [0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]
  46. What will be the output after the following statements?
    a = [0, 1, 2, 3]
    del a
    print(a)
    a. None
    b. Null
    c. [0, 1, 2, 3]
    d. NameError
  47. What will be the output after the following statements?
    a = [0, 1, 2, 3]
    del a[:]
    print(a)
    a. None
    b. []
    c. [0, 1, 2, 3]
    d. NameError
  48. What will be the output after the following statements?
    x = [i*2-4 for i in range(5)]
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [0, 1, 2, 3, 4]
    c. [-4, -2, 0, 2, 4]
    d. [0, 1, 4, 9, 16]
  49. What will be the output after the following statements?
    x = [i**2-3 for i in range(0,7,3)]
    print(x)
    a. [-3, 6, 33]
    b. [0, 1, 2, 3, 4]
    c. [-3, -2, 0, 2, 3]
    d. [-3, 9, 18, 36]
  50. What will be the output after the following statements?
    x = [i**4//7 for i in range(0,6,2)]
    print(x)
    a. [0, 2, 36]
    b. [0, 1, 2, 3, 4]
    c. [0, 6, 2]
    d. [0, 2, 14]
SHARE:

Leave a Comment