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

  1. What will be the output after the following statements?
    b = 3
    for a in range(10, 1):
    b -= a + 1
    print(b)
    a. 7
    b. 4
    c. 3
    d. 8
  2. What will be the output after the following statements?
    b = 1
    for a in range(1, 5):
    b *= a + 1
    print(b)
    a. 120
    b. 40
    c. 36
    d. 250
  3. What will be the output after the following statements?
    a = True
    print(a and not a)
    a. a
    b. False
    c. not a
    d. True
  4. What will be the output after the following statements?
    a = True
    b = False
    print(a == b or not b)
    a. a == b
    b. False
    c. not b
    d. True
  5. What will be the output after the following statements?
    a = ‘Hello’
    b = ‘hello’
    print(a is b)
    a. a is b
    b. False
    c. not b
    d. True
  6. What will be the output after the following statements?
    a = ‘Python’
    b = ‘Python’
    print(a is b)
    a. a is b
    b. False
    c. not b
    d. True
  7. What will be the output after the following statements?
    a = [4, 7, 9]
    b = [4, 7, 9]
    print(a is b)
    a. a is b
    b. False
    c. not b
    d. True
  8. What will be the output after the following statements?
    a = [4, 7, 9]
    b = [7, 4, 9]
    print(a is not b)
    a. a is b
    b. False
    c. not b
    d. True
  9. What will be the output after the following statements?
    a = [3, 6, 9]
    b = [3, 6, 9]
    print(a is b, a == b)
    a. True True
    b. False False
    c. False True
    d. True False
  10. What will be the output after the following statements?
    a = 0
    b = 5
    c = 10
    a = b
    b = c
    c = a
    print(a, b, c)
    a. 0 5 10
    b. 5 10 10
    c. 5 10 5
    d. 5 5 10
  11. What will be the output after the following statements?
    b = 15
    c = 20
    a = b
    b = c
    c = a
    print(b, c)
    a. 20 15
    b. 15 20
    c. a 20
    d. 15 a
  12. In IDLE shell, the output will be the same for all the following statements
    except one. Which one?
    a. 4*3
    b. 60//5
    c. 17-5
    d. 12/1
  13. In IDLE shell, the output will be an error for one of the following
    statements. Which one?
    a. P = ‘python’ * int(‘1’)
    b. P = ‘python’ + 1
    c. P = ‘python’ + str(1)
    d. P = ‘python’ * 1
  14. What will be the output after the following statements?
    a = 4**3
    b = pow(4,3)
    print(a, b)
    a. 4 4
    b. 4 3
    c. 12 12
    d. 64 64
  15. What will be the output after the following statements?
    a = min(10, 15, 6, 17, 24)
    print(a)
    a. (10, 15, 6, 17, 24)
    b. 6
    c. 5
    d. 24
  16. What will be the output after the following statements?
    a = [4, 25, 16, 9, 24]
    print(max(a))
    a. [4, 25, 16, 9, 24]
    b. 9
    c. 25
    d. 24
  17. What will be the output after the following statements?
    a = round(5.3)
    b = round(5.6)
    c = round(5.5)
    print(a, b, c)
    a. 5 5 5
    b. 6 5 6
    c. 5 6 6
    d. 5 6 5
  18. How many times will “Python 3” be printed after the following statements?
    for i in range(1, 5):
    print(‘Python 3’)
    a. 3
    b. 4
    c. 5
    d. 6
  19. What will be the output after the following statements?
    a = round(4.49999)
    print(a)
    a. 4
    b. 5
    c. 4.0
    d. 4.5
  20. What will be the output for a function that does not return any value?
    a. None
    b. No value
    c. Zero
    d. Bool
  21. What type of error will be shown after the following statement?
    a = b
    a. SyntaxError
    b. TypeError
    c. ValueError
    d. NameError
  22. What type of error will be shown after the following statement?
    a = int(‘hello’)
    a. SyntaxError
    b. TypeError
    c. ValueError
    d. NameError
  23. What type of error will be shown after the following statement?
    a = {7)
    a. SyntaxError
    b. TypeError
    c. ValueError
    d. NameError
  24. What type of error will be shown after the following statement?
    a = ‘Python’ + 3
    a. SyntaxError
    b. TypeError
    c. ValueError
    d. NameError
  25. What is the data type of a after the following statement?
    a = {‘A’, ‘B’, ‘C’, ‘D’}
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  26. What is the data type of a after the following statement?
    a = {‘A’:1, ‘B’:2, ‘C’:3, ‘D’:4}
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  27. What is the data type of a after the following statement?
    a = (1, 4, 3, 6)
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  28. What is the data type of a after the following statement?
    a = [1, 4, 3, 6]
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  29. What is the data type used to store values in key values pair?
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  30. In IDLE shell, which of the following statements gives SyntaxError?
    a. “Python\tis\tEasy\n”
    b. “Hello, it’s very easy to learn Python”
    c. “Python”, “easy”
    d. “Python is easy’
  31. What will be the output after the following statements?
    a = 45
    b = 55
    c = (a + b) / 2
    print(c)
    a. 45
    b. 50.0
    c. 45.0
    d. 55.0
  32. Which of the following has the highest precedence in an expression?
    a. Parentheses
    b. Exponential
    c. Division
    d. Subtraction
  33. What will be the output after the following statements?
    a = 4*3**2
    print(a)
    a. 32
    b. 144
    c. 36
    d. 24
  34. What is the name of Python’s built-in module for regular expressions?
    a. regex
    b. regexes
    c. REG
    d. re
  35. What is the name of Python’s built-in module for delimited files?
    a. csv
    b. tsc
    c. delimited
    d. pipe
  36. What is the name of Python’s built-in module for basic date and time types?
    a. date
    b. time
    c. datetime
    d. dates
  37. What is the name of Python’s built-in module for email related tasks?
    a. mailserver
    b. email
    c. message
    d. mail
  38. What is the name of Python’s built-in module for reading passwords?
    a. getpass
    b. password
    c. login
    d. readpass
  39. What is the name of Python’s built-in module for IPv4/IPv6 manipulation?
    a. getip
    b. ipman
    c. ip
    d. ipaddress
  40. What is the name of Python’s built-in module for encoding/decoding JSON
    format?
    a. json
    b. jcode
    c. jsonencode
    d. jsoncode
  41. What is the name of Python’s built-in module for Python keywords?
    a. string
    b. keyword
    c. stringtest
    d. keytest
  42. What is the name of Python’s built-in module for mathematical functions?
    a. maths
    b. mathematics
    c. math
    d. mathfunc
  43. What is the name of Python’s built-in module for operating system
    interfaces?
    interfaces?
    a. windows
    b. liunx
    c. operatingsystem
    d. os
  44. What is the name of Python’s built-in module for data pretty printer?
    a. pprint
    b. print
    c. prettyprint
    d. printp
  45. What is the name of Python’s built-in module for generating pseudo-random
    numbers?
    a. psrandom
    b. random
    c. psuedo
    d. randomnum
  46. What is the name of Python’s built-in module for general purpose event
    scheduler?
    a. scheduler
    b. eventsched
    c. sched
    d. schedule
  47. What is the name of Python’s built-in module for high level file operations?
    a. shutil
    b. fileutil
    c. futility
    d. fileop
  48. What is the name of Python’s built-in module for low level networking
    interface?
    a. net
    b. socket
    c. webking
    d. webworking
  49. What is the name of Python’s built-in module for SQLite databases?
    a. SQL
    b. sqldb
    c. dbase
    d. sqlite3
  50. What is the name of Python’s built-in module for TLS/SSL wrapper for
    socket objects?
    a. ssl
    b. swrap
    c. tlsssl
    d. sslobj
SHARE:

Leave a Comment