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

  1. What will be the output after the following statements?
    x = [25, 35, 45]
    y = x[0]
    print(y)
    a. x0
    b. 25
    c. 35
    d. 45
  2. What will be the output after the following statements?
    x = [10, 20, 30]
    y = x[1] + x[2]
    print(y)
    a. 20
    b. 30
    c. 40
    d. 50
  3. What will be the output after the following statements?
    x = [‘Sunday’, ‘Monday’, ‘Tuesday’]
    y = x[1] + x[2]
    print(y)
    a. MondayTuesday
    b. SundayMonday
    c. SunMonday
    d. Monday Tuesday
  4. What will be the output after the following statements?
    x = [[0.0, 1.0, 2.0],[4.0, 5.0, 6.0]]
    y = x[1][2]
    print(y)
    a. 0.0
    b. 1.0
    c. 5.0
    d. 6.0
  5. What will be the output after the following statements?
    x = [[0.0, 1.0, 2.0],[4.0, 5.0, 6.0]]
    y = x[0][1] + x[1][0]
    print(y)
    a. 1.0
    b. 4.0
    c. 5.0
    d. 6.0
  6. What will be the output after the following statements?
    x = 3
    y = 4
    print(x*y)
    a. 3
    b. 4
    c. 3 4
    d. 12
  7. What will be the output after the following statements?
    x = [15, 45, 85, 95]
    print(x[3]-x[1])
    a. 30
    b. 40
    c. 50
    d. 10
  8. What will be the output after the following statements?
    x = [5, 4, 3, 2]
    print(x)
    a. [5, 4, 3, 2]
    b. 5, 4, 3, 2
    c. 5432
    d. (5, 4, 3, 2)
  9. What will be the output after the following statements?
    x = [5, 4, 3, 2]
    x.append(1)
    print(x)
    a. [5, 4, 3, 2]
    b. 5, 4, 3, 2, 1
    c. 5432
    d. [5, 4, 3, 2, 1]
  10. What will be the output after the following statements?
    x = [5, 4, 3, 2]
    x.insert(1, 0)
    print(x)
    a. [5, 1, 3, 2, 0]
    b. [5, 0, 4, 3, 2]
    c. [0, 5, 4, 3, 2]
    d. [1, 5, 4, 3, 2]
  11. What will be the output after the following statements?
    x = [5, 4, 3, 2]
    x.remove(2)
    print(x)
    a. [5, 3, 2]
    b. [5, 4, 3]
    c. [5, 4, 2]
    d. [3, 2]
  12. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    print(x.pop(3))
    a. 4
    b. 3
    c. 2
    d. 1
  13. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    print(x.index(1))
    a. 4
    b. 3
    c. 2
    d. 1
  14. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    x.extend(x)
    print(x)
    a. [5, 4, 3, 2, 1]
    b. []
    c. [1, 2, 3, 4, 5]
    d. [5, 4, 3, 2, 1, 5, 4, 3, 2, 1]
  15. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    y = [0, 5, 10]
    x.extend(y)
    print(x)
    a. [5, 4, 3, 2, 1, 0, 5, 10]
    b. []
    c. [5, 4, 3, 2, 1]
    d. [0, 5, 10, 5, 4, 3, 2, 1]
  16. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    y = [10, 5, 0]
    x.extend(y)
    print(y)
    a. [5, 4, 3, 2, 1, 10, 5, 0]
    b. []
    c. [10, 5, 0, 5, 4, 3, 2, 1]
    d. [10, 5, 0]
  17. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    y = [10, 5, 0]
    y.extend(x)
    print(y)
    a. [5, 4, 3, 2, 1, 10, 5, 0]
    b. [10, 5, 0, 5, 4, 3, 2, 1]
    c. [5, 4, 3, 2, 1]
    d. [10, 5, 0]
  18. What will be the output after the following statements?
    x = [5, 4, 3, 2, 1]
    x.reverse()
    print(x)
    a. [0, 1, 2, 3, 4, 5]
    b. [0, 5, 4, 3, 2, 1]
    c. [5, 4, 3, 2, 1, 0]
    d. [1, 2, 3, 4, 5]
  19. What will be the output after the following statements?
    x = [25, 14, 53, 62, 11]
    x.sort()
    print(x)
    a. [11, 14, 25, 53, 62]
    b. [25, 14, 53, 62, 11]
    c. [62, 53, 25, 14, 11]
    d. [25, 53, 62, 14, 11]
  20. What will be the output after the following statements?
    x = [’25’, ‘Today’, ’53’, ‘Sunday’, ’15’]
    x.sort()
    print(x)
    a. [‘Today’, ‘Sunday’, ’15’, ’25’, ’53’]
    b. [‘Sunday’, ‘Today’, ’15’, ’25’, ’53’]
    c. [’15’, ’25’, ’53’, ‘Sunday’, ‘Today’]
    d. [’15’, ’25’, ’53’, ‘Today’, ‘Sunday’]
  21. What will be the output after the following statements?
    x = [25, ‘Today’, 53, ‘Sunday’, 15]
    x.reverse()
    print(x)
    a. [‘Today’, ‘Sunday’, 15, 25, 53]
    b. [15, ‘Sunday’, 53, ‘Today’, 25]
    c. [15, 25, 53, ‘Sunday’, ‘Today’]
    d. [15, 25, 53, ‘Today’, ‘Sunday’]
  22. What will be the output after the following statements?
    x = [25, 35, 53, 25, 52, 35, 25]
    print(x.count(25))
    a. 25
    b. 3
    c. 53
    d. 35
  23. What will be the output after the following statements?
    x = [25, 35, 53, 25, 52, 35, 25]
    print(len(x))
    a. 25
    b. 5
    c. 7
    d. 35
  24. What will be the output after the following statements?
    x = [25, 35, 53, 25, 52, 35, 25]
    len(x)
    print(x)
    a. 25
    b. 5
    c. 7
    d. [25, 35, 53, 25, 52, 35, 25]
  25. What will be the output after the following statements?
    x = [25, 35, 53, 25, 52, 35, 25]
    del x[3]
    print(x)
    a. [25, 35, 53, 52, 35, 25]
    b. [25, 5, 5, 25, 52, 5, 25]
    c. [35, 53, 52, 35]
    d. [25, 35, 53, 25, 52, 35, 25]
  26. What will be the output after the following statements?
    x = [5, 3, 6, 2, 4, 0, 1]
    del x[2:3]
    print(x)
    a. [5, 3, 6, 4, 0, 1]
    b. [5, 3, 2, 4, 0, 1]
    c. [5, 6, 2, 4, 0, 1]
    d. [5, 4, 0, 1]
  27. What will be the output after the following statements?
    x = [5, 3, 6, 2, 4, 0, 7]
    del x[0:7]
    print(x)
    a. []
    b. [5, 3, 6, 2, 4, 0, 7]
    c. [5, 3, 6, 2, 4, 0]
    d. [3, 6, 2, 4, 0]
  28. What will be the output after the following statements?
    x = [5, 3, 6, 2, 4, 0, 7]
    del x[0:4]
    print(x)
    a. []
    b. [5, 3, 6, 2, 7]
    c. [5, 3, 6, 2, 4, 0]
    d. [4, 0, 7]
  29. What will be the output after the following statements?
    x = [5, 3, 6, 2, 4, 0, 7]
    del x[:]
    print(x)
    a. []
    b. [5, 3, 6, 2, 7]
    c. [5, 3, 6, 2, 4, 0]
    d. [4, 0, 7]
  30. What will be the output after the following statements?
    x = [4, 0, 7]
    y = str(x[0]) + str(x[1])
    print(y)
    a. 11
    b. 4
    c. 40
    d. 7
  31. What will be the output after the following statements?
    x = [4, 0, 7]
    y = float(x[0] + x[2])
    print(y)
    a. 11
    b. 11.0
    c. 47.0
    d. 47
  32. What will be the data type of x after the following statement?
    x = (34, 81, 50)
    a. List
    b. String
    c. Dictionary
    d. Tuple
  33. What will be the data type of x after the following statement?
    x = ‘Python 3 Test’
    a. List
    b. String
    c. Dictionary
    d. Tuple
  34. What will be the data type of x after the following statement?
    x = [2290, 376, 198]
    a. List
    b. String
    c. Dictionary
    d. Tuple
  35. What will be the data type of x after the following statement?
    x = {‘lang’ :’Python’, ‘version’ : ‘3’}
    a. List
    b. Set
    c. Dictionary
    d. Tuple
  36. What will be the data type of x after the following statement?
    x = {2015, 2016, 2017, 2018}
    a. List
    b. Set
    c. Dictionary
    d. Tuple
  37. What will be the data type of x after the following statement?
    x = [2016, ‘Leap Year’, ‘True’]
    a. List
    b. String
    c. Dictionary
    d. Boolean
  38. What will be the data type of x after the following statement?
    x = False
    a. List
    b. String
    c. Dictionary
    d. Boolean
  39. Which of the following function can be used to find the data type of a
    variable?
    a. data()
    b. type()
    c. true()
    d. str()
  40. What will be the output after the following statements?
    x = [24, 50, 37]
    y = 24 in x
    print(y)
    a. x[0]
    b. [24]
    c. True
    d. False
  41. What will be the output after the following statements?
    x = {‘A’, ‘B’, ‘C’}
    y = ‘b’ in x
    print(y)
    a. x[1]
    b. [‘B’]
    c. True
    d. False
  42. What will be the output after the following statements?
    x = ‘Python’
    y = ‘y’ in x
    print(y)
    a. [1]
    b. y
    c. True
    d. False
  43. What will be the output after the following statements?
    x = {0:4, 1:8, 2:16, 3:32}
    y = 0 in x
    print(y)
    a. x[0]
    b. [24]
    c. True
    d. False
  44. What will be the output after the following statements?
    x = {0:4, 1:8, 2:16, 3:32}
    y = 8 in x
    print(y)
    a. x[0]
    b. [24]
    c. True
    d. False
  45. What will be the data type of x after the following statements?
    false = “This is not true”
    x = false
    a. List
    b. String
    c. Dictionary
    d. Boolean
  46. Which of the following is immutable (values that cannot be changed)?
    a. List
    b. Dictionary
    b. Dictionary
    c. Tuple
    d. Set
  47. Which of the following has only unique values?
    a. List
    b. Dictionary
    c. Tuple
    d. Set
  48. What will be the output after the following statements?
    x = {0:4, 1:8, 2:16, 3:32}
    print(x.keys())
    a. dict_keys([0, 1, 2, 3])
    b. dict_keys{0, 1, 2, 3}
    c. dict_keys(0, 1, 2, 3)
    d. dict_keys[0, 1, 2, 3]
  49. What will be the output after the following statements?
    x = {0:4, 1:8, 2:16, 3:32}
    print(x.values())
    a. dict_values([4, 8, 16, 32])
    b. dict_values{4, 8, 16, 32}
    c. dict_values(4, 8, 16, 32)
    d. dict_values[4, 8, 16, 32]
  50. What will be the output after the following statements?
    x = {1:’Jan’, 2:’Feb’, 3:’March’, 4:’April’}
    print(x[2])
    a. Jan
    b. Feb
    c. March
    d. April
SHARE:

Leave a Comment