Chapter 2: Python Programming
11th Class Computer Science – Punjab Board / PTCB
Full-Length Multiple Choice Questions (MCQs) with Answers
1. Who developed Python programming language?
A) Dennis Ritchie
B) Guido van Rossum
C) James Gosling
D) Charles Babbage
Correct Answer: B
2. Python was developed in which year?
A) 1989
B) 1990
C) 1991
D) 1995
Correct Answer: C
3. Python is a ______ language.
A) Low-level
B) Assembly
C) High-level
D) Machine
Correct Answer: C
4. Which of the following is the correct extension for Python files?
A) .p
B) .py
C) .pt
D) .pyc
Correct Answer: B
5. Python is a _______ typed language.
A) Statically
B) Dynamically
C) Weakly
D) Strongly
Correct Answer: B
6. What symbol is used for comments in Python?
A) //
B) /*
C) #
D) <!--
Correct Answer: C
7. Which of these is not a feature of Python?
A) Portable
B) Interpreted
C) Platform dependent
D) Easy to learn
Correct Answer: C
8. What does the ** operator do in Python?
A) Modulus
B) Division
C) Exponent
D) Floor division
Correct Answer: C
9. Which function is used to take input from the user?
A) get()
B) input()
C) scanf()
D) read()
Correct Answer: B
10. Which function is used to display output on screen?
A) display()
B) print()
C) write()
D) show()
Correct Answer: B
11. What is the output of print(10 // 3)?
A) 3.3
B) 3
C) 4
D) Error
Correct Answer: B
12. Which of the following is immutable in Python?
A) List
B) Tuple
C) Dictionary
D) Set
Correct Answer: B
13. The keyword used to define a function is:
A) func
B) define
C) def
D) function
Correct Answer: C
14. What will be the output of print('5' + '3')?
A) 8
B) 53
C) Error
D) 5 3
Correct Answer: B
15. What is indentation used for in Python?
A) Decoration
B) To define code blocks
C) To skip lines
D) None
Correct Answer: B
16. Which of the following data types is used to store textual data?
A) int
B) str
C) float
D) bool
Correct Answer: B
17. What will be the output of print(type(3.14))?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'number'>
Correct Answer: B
18. Which of these keywords is used for decision making?
A) for
B) if
C) switch
D) case
Correct Answer: B
19. What is the purpose of the while loop?
A) Repeat code until condition is false
B) Execute code once
C) Skip statements
D) None
Correct Answer: A
20. Which operator is used for equality comparison?
A) =
B) ==
C) !=
D) >
Correct Answer: B
21. The statement to include comments in Python starts with:
A) /*
B) //
C) #
D) --
Correct Answer: C
22. What does len('Hello') return?
A) 4
B) 5
C) 6
D) Error
Correct Answer: B
23. Which of the following creates an empty list?
A) {}
B) []
C) ()
D) None
Correct Answer: B
24. The range(5) function generates:
A) 0 1 2 3 4
B) 1 2 3 4 5
C) 0 2 4 6 8
D) Error
Correct Answer: A
25. Which operator is used for logical AND operation?
A) &&
B) and
C) &
D) +
Correct Answer: B
26. What is the output of bool(0)?
A) True
B) False
C) 0
D) 1
Correct Answer: B
27. What is the result of 10 % 3?
A) 1
B) 2
C) 3
D) 0
Correct Answer: A
28. What is the function of the break statement?
A) Stop current loop
B) Skip iteration
C) Exit program
D) None
Correct Answer: A
29. Which function is used to find the data type of a variable?
A) datatype()
B) typeof()
C) type()
D) id()
Correct Answer: C
30. What does the continue statement do?
A) Stop loop
B) Restart loop
C) Skip current iteration
D) Exit program
Correct Answer: C