MCQ of Python | Python MCQ with Answer

1. Which type of programming does python support?

a. Object oriented programming

b. Structured programming

c. Functional Programming

d. All of the mentioned

2. Who developed Python Programming Language?

a. Wick van Rossum

b. Rasmus Lerdorf

c. Guido van Rossum

d. Sergey Brin

3. In which year was the Python language developed?

a. 1995

b. 1972

c. 1981

d. 1989

4. Python is a:

a. Low-level language

b. High-level language

c. Middle-level language

d. Machine-level language

5. Which of these data types does Python not natively support?

a. Lists

b. Tuples

c. Arrays

d. Dictionaries

6. Which of the following is a mutable data type in Python?

a. String

b. Tuple

c. List

d. Integer

7. Which of the following is an immutable data type?

a. Lists

b. Dictionaries

c. Tuples

d. Sets

8. What data type would you use to store a whole number in Python?

a. Int

b. Float

c. Str

d. Bool

9. What will be the data type of the variable x after this assignment:

x = 3.5?

a. Int

b. Float

c. Str

d. complex

10. Which of the following is the correct extension of the Python file?

a. .python

b. .pl

c. .py

d. .p

11. Which function in Python is used to display data as output?

a. display()

b. print()

c. show()

d. output()

12. All keywords in Python are in _________

a. Capitalized

b. lower case

c. UPPER CASE

d. None of the mentioned

13. Which of the following character is used to give single-line comments in Python?

a. //

b. #

c. !

d. /*

14. Which of the following is used to define a block of code in Python language?

a. Indentation

b. Key

c. Brackets

d. All of the mentioned

15. What is the purpose of the end parameter in the print() function?

a. To add a space at the end

b. To end the script

c. To specify the string appended after the last value

d. To break the line

16. What does the sep parameter do in the print() function?

a. Separates lines

b. Specifies separator between values

c. Separates syntax errors

d. None of these

17. What will be the output of

print(“Python”, “Programming”, sep=”-“)

  1. Python-Programming
  2. Python Programming
  3. PythonProgramming
  4. Python,Programming

18. What is the output of

print(“Hello”, end=’@’);
print(“World”)

  1. HelloWorld
  2. Hello@World
  3. Hello World
  4. Hello@ World

19. Identify the error:

print(“Hello World!”))

  1. Missing quotation marks
  2. Extra parenthesis
  3. Missing parenthesis
  4. No error

20. When a new value is stored in a variable, its previous value gets ___

a. Accepted

b. Overwritten

c. Overlapped

d. Overview

21. Which of the following is the truncation division operator in Python?

a. |

b. //

c. /

d. %

22. Which of the following statements is used to create an empty set in Python?

a. ( )

b. [ ]

c. { }

d. set()

23. Is Python case sensitive when dealing with identifiers?

a. No

b. Yes

c. machine dependent

d. none of the mentioned

24. Is Python code compiled or interpreted?

a. Python code is both compiled and interpreted

b. Python code is neither compiled nor interpreted

c. Python code is only compiled

d. Python code is only interpreted

25. In which language is Python written?

a. C

b. C++

c. Java

d. None of these

26. What is a correct syntax to output “Hello World” in Python?

a. print(“Hello World”)

b. echo “Hello World”

c. echo(“Hello World”)

d. p(“Hello World”)

27. Which of the following is a valid Python comment?

a. <!−− −−>

b. /* */

c. #

d. //

28. What is the order of precedence in python?

a. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

b. Exponential, Parentheses, Division, Multiplication, Addition, Subtraction

c. Parentheses, Exponential, Multiplication, Division, Subtraction, Addition

d. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

29. Which of the following is a Python tuple?

a. {1, 2, 3}

b. {}

c. [1, 2, 3]

d. (1, 2, 3)

30. Which of the following is not a core data type in Python programming?

a. Tuples

b. Lists

c. Class

d. Dictionary

31. Which one of the following has the same precedence level?

a. Division, Power, Multiplication, Addition and Subtraction

b. Division and Multiplication

c. Subtraction and Division

d. Power and Division

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

a. Division

b. Subtraction

c. Power

d. Parentheses

33. Which keyword is used for function in Python language?

a. Function

b. Def

c. Fun

d. Define

34. Which one of the following is the use of function in python?

a. Functions don’t provide better modularity for your application

b. you can’t also create your own functions

c. Functions are reusable pieces of programs

d. All of the mentioned

35. What are the two main types of functions in Python?

a. System function

b. Custom function

c. Built-in function & User defined function

d. User function

4 thoughts on “MCQ of Python | Python MCQ with Answer”

Leave a Comment