12TH computer science pt1
12TH computer science pt1
12TH computer science pt1
2. All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of
the choices in such questions.
5. In case of MCQ, the text of the correct answer should also be written.
Section A
10. [MCQ] Which of the following methods is used to add an item to the end of a list in Python?
15. [MCQ] Which of these libraries is used for data manipulation in Python?
(a) NumPy (b) Pandas (c) Matplotlib (d) Scipy
21. Name two functions used to read input from a user in Python.
Section B
24. Describe the difference between list and tuple in Python with examples.
25. Explain the role of comments in Python. How do you write single-line and multi-line comments?
26. Write a program to calculate the area of a circle given its radius.
28. Write a Python code to find the largest number among three numbers provided by the user.
Section C
29. Explain the concept of a function in Python and write a sample function to add two numbers.
30. What are dictionaries in Python? Create a dictionary with at least three key-value pairs.
31. Write a Python program that calculates the factorial of a number using recursion.
Section D
32. What are lambda functions in Python? Write a lambda function to find the square of a number.
34. Explain the role of try, except, and finally blocks in exception handling with an example.
35. Write a Python program to find the sum of all even numbers in a list.
Section E
36. Write a Python program to create a class named Rectangle with attributes length and width. Include methods to
calculate area and perimeter. Provide an example of how to create an instance of this class and use its methods.
37. Describe how file handling works in Python. Write a program to read from a text file and count the number of words
in the file.