Python Exam Preparation Notes - B.
Tech CSE
Theory Questions - Easy Level
1. What are the features of Python?
2. What is the difference between list, tuple, set, and dictionary?
3. What is indentation in Python? Why is it important?
4. Explain different types of operators in Python.
5. What is the difference between `is` and `==` in Python?
6. Explain dynamic typing with an example.
7. Write the syntax of:
- Function definition
- Loop (for/while)
- if-elif-else
Theory Questions - Medium Level
8. What is the difference between local and global variables?
9. What is recursion? Write an example.
10. What is exception handling in Python? Explain with example.
Python Exam Preparation Notes - B.Tech CSE
11. Explain the concept of OOPs in Python.
12. What are lambda functions? How are they useful?
13. What is list comprehension? Give two examples.
14. What is the use of `map()`, `filter()`, and `reduce()`?
Theory Questions - Advanced Level
15. What are modules and packages in Python?
16. What is the difference between shallow copy and deep copy?
17. Compare mutable and immutable data types in Python with examples.
18. Explain the working of `with open()` in file handling.
19. How is inheritance implemented in Python? Give an example.
Coding Questions - Beginner
1. Write a Python program to take two numbers as input and print their sum, difference, product, and division.
2. Write a program to check whether a number is even or odd.
3. Write a program to find the largest of three numbers using if-else.
Python Exam Preparation Notes - B.Tech CSE
4. Write a program to reverse a string.
5. Write a program to print multiplication table of a number using for loop.
Coding Questions - Intermediate
6. Write a function to find factorial of a number (using recursion).
7. Write a program to check whether a string is a palindrome.
8. Write a Python program to count vowels and consonants in a string.
9. Create a list of numbers from 1 to 10, then use:
- map() to square each number
- filter() to get even numbers
10. Take a list of numbers and remove all duplicates using a set.
File Handling Questions
11. Write a program to write your name and age into a file.
12. Write a program to read and display content of a file.
13. Write a program that appends text to an existing file.
OOP Questions
Python Exam Preparation Notes - B.Tech CSE
14. Create a class Student with attributes name, age, and grade. Add a method to display student details.
15. Create two classes Person and Employee where Employee inherits from Person. Show constructor
overriding.
Advanced Logic Practice
16. Write a Python program to print the Fibonacci sequence up to n terms.
17. Write a Python program to check whether a number is prime or not.
18. Create a dictionary to store 3 students' names and their marks. Print all keys and values.
19. Write a Python program to sort a list of tuples by the second element.