Python MCQ Quiz

Take Python Quiz To test your Knowledge 

Below are few Python MCQ test that checks your basic knowledge of Python. This Python Test contains around 20 questions of multiple choice with 4 options. You have to select the right answer to a question. You can see the correct answer by clicking view answer link.

Also, Read Best Python Flask interview questions.

1. Which of the following is the use of id() function in python?

  • Every object doesn’t have a unique id
  • Id returns the identity of the object
  • All of the mentioned
  • None of the mentioned
View Answer

2. Is Python case sensitive when dealing with identifiers?

  • yes
  • no
View Answer

3. All keywords in Python are in

  • UPPER CASE
  • lower case
  • Capitalized
  • None of the mentioned
View Answer

4. Mathematical operations can be performed on a string. State whether true or false -

  • False
  • True
View Answer

5. Which one of the following has the highest precedence in the expression?

  • Addition
  • Multiplication
  • Exponential
  • Parentheses
View Answer

6. What is the return type of function id?

  • float
  • bool
  • dict
  • int
View Answer

7. What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))

  • Hello ‘foo’ and foo
  • Hello foo and foo
  • Hello foo and ‘bin’
  • Error
View Answer

8. Which of the following data types is not supported in python ?

  • String
  • Numbers
  • Slice
  • List
View Answer

9. Which Of The Following Keywords Mark The Beginning Of The Class Definition?

  • return
  • class
  • def
  • All of the above
View Answer

10. Select the reserved keyword in python-

  • else
  • raise
  • import
  • All of the above
View Answer

11. Are nested if-else are allowed in Python?

  • Yes
  • no

12. Python allows string slicing. What is the output of below code: s='cppbuzz chicago' print(s[3:5])

  • buzzc
  • pbuzz
  • bu
  • None of these

13. class test: def __init__(self): print "Hello World" def __init__(self): print "Bye World" obj=test()

  • Bye World
  • Hello World
  • Compilation Error
  • Ambiguity
View Answer

14. The format function, when applied on a string returns :

  • list
  • bool
  • int
  • str
View Answer

15. Which statement is correct....??

  • List is mutable && Tuple is immutable
  • List is mutable && Tuple is immutable
  • Both are Mutable.
  • Both are Immutable
View Answer

16. What is the maximum possible length of an identifier?

  • 32 characters
  • 63 characters
  • 79 characters
  • None of the above
View Answer

17. Which one of the following is not a python's predefined data type?

  • List
  • Dictionary
  • Tuple
  • Class
View Answer

18. What will be the output of 7^10 in python?

  • 13
  • 15
  • 2
  • None of these

19. 19 % 2 in python

  • 2
  • 17
  • None of these
View Answer

20. Which of the following has more precedance?

  • /
  • +
  • ()
  • -
View Answer

21. Is Tuple mutable?

  • yes
  • no
View Answer

Write For Us.

Contribute the Community.