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

  1. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%x’))
    a. Displays the time appropriate for locale
    b. Displays the current year as 00 to 99
    c. Displays the current year as 0001 to 9999
    d. Displays the date appropriate for locale
  2. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%X’))
    a. Displays the current year as 0001 to 9999
    b. Displays the timezone name
    c. Displays the time appropriate for locale
    d. Displays the current year as 00 to 99
  3. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%y’))
    a. Displays the current year as 00 to 99
    b. Displays the current year as 0001 to 9999
    c. Displays the timezone name
    d. Displays the timezone offset from UTC as +HHMM or -HHMM
  4. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%Y’))
    a. Displays the current year as 0001 to 9999
    b. Displays the timezone name
    c. Displays the timezone offset from UTC as +HHMM or -HHMM
    d. Displays the full month name
  5. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%Z’))
    a. Displays the timezone offset from UTC as +HHMM or -HHMM
    b. Displays the timezone name
    c. Displays the abbreviated month name
    d. Displays the full month name
  6. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%z’))
    a. Displays the full month name
    b. Displays the abbreviated month name
    c. Displays the abbreviated day name
    d. Displays the timezone offset from UTC as +HHMM or -HHMM
  7. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%a’))
    a. Displays the full month name
    b. Displays the full day name
    c. Displays the abbreviated day name
    d. Displays the abbreviated month name
  8. What does the following statements do?
    from datetime import *
    print(datetime.today().strftime(‘%b’))
    a. Displays the full month name
    b. Displays the abbreviated month name
    c. Displays the full day name
    d. Displays the abbreviated day name
  9. What does the following statements do?
    from time import *
    print(time())
    a. Displays the current time in seconds since the Epoch as a floating point number
    b. Displays the current time in minutes since the Epoch as a floating point number
    c. Displays the current time in seconds since the Epoch as an integer
    d. Displays the current time in minutes since the Epoch as an integer
  10. What does the following statements do?
    from time import *
    sleep(3)
    a. Pauses the execution of the program by 3 minutes
    b. Pauses the execution of the program by 3 seconds
    c. Displays the current time in seconds since the Epoch as an integer
    d. Displays the current time in minutes since the Epoch as an integer
  11. What will be the output after the following statements?
    x = ‘Python’
    y = ‘MCQ’
    print(x + y)
    a. Python Python
    b. MCQ MCQ
    c. Python MCQ
    d. PythonMCQ
  12. What will be the output after the following statements?
    x = ‘Python ‘
    print(x*3)
    a. Pyt Pyt Pyt
    b. t
    c. Python Python Python
    d. PythonPythonPython
  13. What will be the output after the following statements?
    x = ‘Python ‘
    print(x[4])
    a. h
    b. t
    c. Python Python Python Python
    d. o
  14. What will be the output after the following statements?
    x = ‘Python’
    print(x[2:4])
    a. Pyth
    b. th
    c. tho
    d. thon
  15. What will be the output after the following statements?
    x = ‘Python’
    print(x[:])
    a. yth
    b. Pn
    c. Python
    d. PythonPythonPython
  16. What will be the output after the following statements?
    x = ‘Python’
    print(‘y’ in x)
    a. y
    b. Y
    c. Python
    d. True
  17. What will be the output after the following statements?
    x = ‘Python’
    print(‘p’ not in x)
    a. p
    b. P
    c. True
    d. False
  18. What will be the output after the following statements?
    x = ‘{} 3 {}’.format(‘Python’, ‘Test’)
    print(x)
    a. Python 3 Test
    b. Python Test
    c. Test 3 Python
    d. Test Python
  19. What will be the output after the following statements?
    x = ‘{1} for {0}’.format(‘Python’, ‘Questions’)
    print(x)
    a. Python for Questions
    b. Questions for Python
    c. 1 for 0
    d. Python 1 for 0 Questions
  20. What will be the output after the following statements?
    x = ‘%s MCQ %s’ %(‘Python’, ‘Test’)
    print(x)
    a. Python MCQ
    b. MCQ Test
    c. Test MCQ Python
    d. Python MCQ Test
  21. What will be the output after the following statements?
    x = ‘Python %d Version’ %(3)
    print(x)
    a. Python 3
    b. 3 Version
    c. Python 3 Version
    d. Python Version 3
  22. What will be the output after the following statements?
    x = ‘Python %c or Python %c’ %(‘2’, ‘3’)
    print(x)
    a. Python 3 or Python 2
    b. Python 2 or Python 3
    c. Python 2 or Python 2
    d. Python 23
  23. What will be the output after the following statements?
    x = ‘Python %.1f or Python %.2f’ %(2.7, 3.51)
    print(x)
    a. Python 3.51 or Python 2.7
    b. Python 2 or Python 3
    c. Python 2.7 or Python 3.5
    d. Python 2.7 or Python 3.51
  24. What will be the output after the following statements?
    x = ‘Python’
    print(x.capitalize())
    a. Python
    b. Python.capitalize
    c. PYTHON
    d. pYTHON
  25. What will be the output after the following statements?
    x = ‘python job interview’
    print(x.title())
    a. python job interview
    b. Python job interview
    c. Python Job Interview
    d. Python job Interview
  26. What will be the output after the following statements?
    x = ‘python jobs’
    print(x.upper())
    a. PYTHON JOBS
    b. Python jobs
    c. Python Jobs
    d. python jobs
  27. What will be the output after the following statements?
    x = ‘python jobs’
    print(x.lower())
    a. PYTHON JOBS
    b. Python jobs
    c. Python Jobs
    d. python jobs
  28. What will be the output after the following statements?
    x = ‘Python Jobs’
    print(x.swapcase())
    a. PYTHON JOBS
    b. pYTHON jOBS
    c. Python Jobs
    d. python jobs
  29. What will be the output after the following statements?
    x = ‘Python’
    print(x.join(’33’))
    a. Python33
    b. 3Python3
    c. Python3
    d. Python 33
  30. What will be the output after the following statements?
    x = ‘Python Test’
    print(x.join(’33’))
    a. 3Python Test3
    b. 3Python3Test
    c. Python3Test3
    d. Python Test33
  31. What will be the output after the following statements?
    x = ‘ Python ‘
    y = ‘3’
    print(x.lstrip()+y.lstrip())
    a. Python 3
    b. 3Python3
    c. Python3
    d. Python+3
  32. What will be the output after the following statements?
    x = ‘Python ‘
    y = ‘3 ‘
    print(x.rstrip()+y.rstrip())
    a. Python 3
    b. 3Python3
    c. Python3
    d. Python+3
  33. What will be the output after the following statements?
    x = ‘ Python ‘
    y = ‘ 3 ‘
    z = ‘ Questions ‘
    print(x.strip()+y.strip()+z.strip())
    a. Python 3 Questions
    b. Python3Questions
    c. Python3 Questions
    d. Python 3Questions
  34. What will be the output after the following statements?
    x = ‘Interview’
    print(x.replace(‘e’,’ ‘))
    a. Interview
    b. Intrviw
    c. I n t e r v i e w
    d. Int rvi w
  35. What will be the output after the following statements?
    x = ‘MCQs’
    print(x.ljust(10,’*’))
    a. MCQs******
    b. M C Q S
    c. ******MCQs
    d. M C Q s
  36. What will be the output after the following statements?
    x = ‘MCQs’
    print(x.rjust(10,’*’))
    a. MCQs******
    b. M C Q S
    c. ******MCQs
    d. M C Q s
  37. What will be the output after the following statements?
    x = ‘MCQs’
    print(x.center(10,’*’))
    a. MCQs******
    b. ***MCQs***
    c. ******MCQs
    d. M C Q s
  38. What will be the output after the following statements?
    x = ‘Python Pi Py Pip’
    print(x.count(‘p’))
    a. 1
    b. 0
    c. 4
    d. 5
  39. What will be the output after the following statements?
    x = ‘Python Pi Py’
    print(x.find(‘p’))
    a. -1
    b. 0
    c. 1
    d. 3
  40. What will be the output after the following statements?
    x = ‘Python Pi Py’
    print(x.find(‘P’))
    a. -1
    b. 0
    c. 1
    d. 3
  41. What will be the output after the following statements?
    x = ‘Pi Py Python’
    print(x.startswith(‘p’))
    a. 1
    b. 0
    c. True
    d. False
  42. What will be the output after the following statements?
    x = ‘Pi Py Python’
    print(x.endswith(‘n’))
    a. 1
    b. 0
    c. True
    d. False
  43. What will be the output after the following statements?
    x = ‘Python’
    print(x.isalpha())
    a. 1
    b. 0
    c. True
    d. False
  44. What will be the output after the following statements?
    x = ‘Python 3’
    print(x.isnumeric())
    a. 1
    b. 0
    c. True
    d. False
  45. What will be the output after the following statements?
    x = ‘Python 3 MCQ’
    print(x.isalnum())
    a. 1
    b. 0
    c. True
    d. False
  46. What will be the output after the following statements?
    x = ‘Python 3 MCQ’
    print(x.islower())
    a. True
    b. False
    c. 1
    d. 0
  47. What will be the output after the following statements?
    x = ‘Python 3 MCQ’
    print(x.istitle())
    a. True
    b. False
    c. 1
    d. 0
  48. What will be the output after the following statements?
    x = ‘MCQ’
    print(x.isupper())
    a. True
    b. False
    c. 1
    d. 0
  49. What will be the output after the following statements?
    x = ‘\n’
    print(x.isspace())
    a. True
    b. False
    c. 1
    d. 0
  50. What will be the output after the following statements?
    x = ‘2000’
    print(x.isdigit())
    a. True
    b. False
    c. 1
    d. 0
SHARE:

Leave a Comment