Q1: Short Answer Type (1 mark each)
1. What is indentation in Python?
2. What is a dry run in Python?
3. List the features of Python.
4. What are break and continue statements?
5. What is a slice operator?
6. What is a lambda function? Write an example.
7. What is a package?
8. List the types of type conversion in Python.
9. What is the use of the pass statement?
10. What are required arguments in functions?
11. List two built-in exceptions.
12. Explain the function enumerate( ).
13. Explain the extend( ) method of list.
14. Write the use of seek( ) and tell( ).
15. What are text and binary files?
16. What is variable-length argument?
17. What are identifiers in Python?
18. Explain the remove( ) method in lists.
19. Write a lambda function to add 10 to a given integer.
20. What are the functions clock( ) and gmtime( ) used for?
Q2: Medium Answer Type (2 marks each)
1. Explain backward indexing in strings.
2. Explain recursion with example.
3. Explain any two functions from the time module.
4. Explain built-in string methods with example.
5. Explain basic tuple operations with example.
6. How to handle exceptions in Python?
7. Explain set union and set intersection with example.
8. How to create and use a package in Python?
9. Explain two meta-characters used in Regular Expressions.
10. List and explain any two built-in list functions.
Q3: Long Answer / Programs (4 marks each)
1. Write a program to accept a string from user and display it in reverse after removing
all ‘s’.
2. Write a Python program to raise a user-defined exception to check if age < 18.
3. Write a Python program to check if a given number is Armstrong.
4. Write a Python program to display power of 2 using an anonymous function.
5. Write a Python program to print even length words in a string.
6. Write a Python program to check if a string contains only alphabets and digits.
7. Write a Python program to add “ing” at the end of a given string. If it ends with
“ing”, add “ly”.
8. Write a Python program to combine values in a list of dictionaries.
9. Write a Python program to extract year, month, date, and time using Lambda.
10. Write a Python program to check Zero Division Error exception.
11. Write a Python program to find GCD using recursion.
12. Write a Python program to check if a given key exists in a dictionary.
13. Write a Python program to put even and odd elements of a list into two separate lists.
14. Write a Python program to count vowels and consonants in a string.
15. Write a Python program to check whether a given string is a Palindrome or not.
16. Write a Python program to find factorial of a number.
Q4: Output Tracing (3 marks each)
1. Trace the output of list aliasing and slicing operations.
2. Trace the output of dictionary update program with functions.
3. Trace the output of:
sum = 0
for i in range(12, 2, -2):
sum += i
print(sum)
4. Trace the output of recursion/global variable modification program.
5. Trace the output of exception handling program with division by zero.
6. Trace the output of loop and summation program.