Section A: Very Short Answer (1–2 marks)
1. What is Python?
2. Who developed Python?
3. Write any two features of Python.
4. What is a variable in Python?
5. Write the output of:
print(5 + 10 * 2)
6. What is the use of the print() function?
7. Name any two data types in Python.
8. What is a comment in Python? How is it written?
9. What is the difference between = and ==?
10. What is the extension of a Python file?
11. Write the output of:
print(type(5.0))
Section B: Short Answer (2–3 marks)
11. Explain rules for naming variables in Python.
12. What are operators? Name any four types of operators in Python.
13. Write a Python program to display your name.
14. What is type conversion? Give one example.
15. Explain the use of input() function with an example.
Section C: Long Answer / Programming (4–5 marks)
16. Write a Python program to find the sum of two numbers.
17. Write a program to check whether a number is even or odd.
18. Write a program to find the square of a number using user input.
19. Explain if statement with an example.
20. Write a Python program to print numbers from 1 to 10 using a for loop.
Section A: Multiple Choice Questions (1 × 5 = 5 marks)
1. Which of the following is used to display output in Python?
a) input()
b) print()
c) show()
d) display()
2. What will be the output of:
print(10 // 3)
a) 3.33
b) 3
c) 4
d) Error
3. Which data type is used to store True or False values?
a) int
b) float
c) bool
d) str
4. Which symbol is used for comments in Python?
a) //
b) <!-- -->
c) #
d) **
5. Which of the following is a valid variable name?
a) 2name
b) name_2
c) name-2
d) class
Section D: Long Answer / Programming (5 × 4 = 20 marks)
16. Write a Python program to check whether a number is positive, negative, or zero.
17. Write a program to print the table of a number entered by the user.
18. Explain if-else statement with a suitable example.
19. Write a Python program to find the largest of three numbers.
20. Write a Python program to calculate the total and average marks of a student in 5
subjects.
21.
1. Create a list using user input
n = int(input("Enter number of elements: "))
lst = []
for i in range(n):
[Link](input("Enter element: "))
print(lst)
2. Add an element using append()
lst = [1, 2, 3]
item = int(input("Enter element to add: "))
[Link](item)
print(lst)
22. 3. Add multiple elements using extend()
23. Insert an element at a given position using insert()
lst = [5, 10, 15]
pos = int(input("Enter position: "))
item = int(input("Enter element: "))
[Link](pos, item)
print(lst)
24. Remove an element using remove()
lst = [1, 2, 3, 4]
item = int(input("Enter element to remove: "))
[Link](item)
print(lst)
25. Delete last element using pop()
lst = [10, 20, 30, 40]
[Link]()
print(lst)
26. Find length of list using len()
lst = [10, 20, 30, 40]
print("Length of list:", len(lst))
27. Sort a list using sort()
lst = [10, 20, 30, 40]
[Link]()
print("Sorted list:", lst)
28. Reverse a list using reverse()
lst = [10, 20, 30, 40]
[Link]()
print("Reversed list:", lst)
29. Count occurrence of an element using count()
lst = [10, 20, 30, 40]
item = int(input("Enter element to count: "))
print("Count:", [Link](item))
Print numbers from 1 to 10 using while loop
i = 1
while i <= 10:
print(i)
i += 1
2. Print even numbers from 1 to 20 using while loop
i = 2
while i <= 20:
print(i)
i += 2
3. Print odd numbers from 1 to 20 using while loop
i = 1
while i <= 20:
print(i)
i += 2
5. Print multiplication table of a given number
n = int(input("Enter number: "))
i = 1
while i <= 10:
print(n, "x", i, "=", n*i)
i += 1
Write a program to check whether a given number is positive or negative using if–else.
Write a program to check whether a given number is even or odd using if–else.
Write a program to find the greater of two numbers using if–else.
Write a program to check whether a given number is divisible by 5 and 11 using if–else.
Write a program to find the largest among three numbers using if–else.
Write a program to check whether a given character is a vowel or consonant using if–else.
Write a program to calculate grade of a student based on marks using if–else.
Write a program to calculate electricity bill based on units consumed using if–else.