Alright — I’ll prepare MCQs for all four chapters of 2nd PUC Computer Science
(Python-focused), so you get complete practice.
I’ll cover basic, intermediate, and tricky ones so you’re ready for exam-style questions.
---
Chapter 1: Exception Handling in Python
1. Which keyword is used to handle exceptions in Python?
a) try
b) except
c) catch
d) handle
Answer: b) except
2. In Python, which block is always executed whether an exception occurs or not?
a) finally
b) except
c) else
d) try
Answer: a) finally
3. What will be the output of:
try:
print(10/0)
except ZeroDivisionError:
print("Error")
a) Error
b) ZeroDivisionError
c) 0
d) None
Answer: a) Error
4. Which exception occurs when trying to open a file that does not exist?
a) IOError
b) FileNotFoundError
c) NameError
d) ImportError
Answer: b) FileNotFoundError
5. What is the correct syntax for handling multiple exceptions?
a) except(Exception1, Exception2):
b) except Exception1 or Exception2:
c) except Exception1, Exception2:
d) except [Exception1, Exception2]:
Answer: a) except(Exception1, Exception2):
---
Chapter 2: File Handling in Python
6. Which mode is used to open a file for reading?
a) 'w'
b) 'r'
c) 'a'
d) 'x'
Answer: b) 'r'
7. What will 'w' mode do if the file already exists?
a) Append data to the file
b) Overwrite the file
c) Read the file
d) Create an error
Answer: b) Overwrite the file
8. Which function is used to read all lines of a file?
a) read()
b) readline()
c) readlines()
d) readall()
Answer: c) readlines()
9. Which function is used to close a file in Python?
a) close()
b) stop()
c) end()
d) exit()
Answer: a) close()
10. 'a' mode in file handling is used for:
a) Append data to a file
b) Read data from a file
c) Overwrite the file
d) Create a temporary file
Answer: a) Append data to a file
---
Chapter 3: Stack
11. Stack follows which principle?
a) FIFO
b) LIFO
c) FILO
d) Both b & c
Answer: d) Both b & c
12. Which operation adds an element to a stack?
a) pop()
b) push()
c) insert()
d) append()
Answer: b) push()
13. Which operation removes the top element from the stack?
a) push()
b) delete()
c) pop()
d) remove()
Answer: c) pop()
14. In Python, which list method can be used to implement stack push?
a) insert()
b) append()
c) add()
d) push()
Answer: b) append()
15. What will happen if we pop from an empty stack?
a) Returns None
b) IndexError
c) No error
d) ZeroDivisionError
Answer: b) IndexError
---
Chapter 4: Queue
16. Queue follows which principle?
a) FIFO
b) LIFO
c) FILO
d) LILO
Answer: a) FIFO
17. Which operation inserts an element into a queue?
a) enqueue()
b) append()
c) push()
d) insert()
Answer: a) enqueue()
18. Which operation removes an element from a queue?
a) dequeue()
b) pop()
c) delete()
d) remove()
Answer: a) dequeue()
19. Which Python module provides Queue implementation?
a) queue
b) collections
c) stack
d) list
Answer: a) queue
20. In Python’s [Link], what happens if you call get() on an empty queue?
a) Returns None immediately
b) Raises an error
c) Waits until an item is available
d) Creates a new queue
Answer: c) Waits until an item is available
---
If you want, I can also make a "one-page final MCQ PDF" with 60+ questions from these
chapters so you can revise quickly before exams.
Do you want me to prepare that full PDF now?