0% found this document useful (0 votes)
19 views4 pages

Top 100 Python Revision Questions

The document contains a comprehensive list of 100 Python revision questions covering various topics such as syntax, data structures, conditional statements, functions, object-oriented programming, file handling, and exception handling. Each section includes practical programming tasks and theoretical questions to test understanding of Python concepts. It serves as a study guide for individuals looking to reinforce their Python knowledge and skills.

Uploaded by

sangam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Top 100 Python Revision Questions

The document contains a comprehensive list of 100 Python revision questions covering various topics such as syntax, data structures, conditional statements, functions, object-oriented programming, file handling, and exception handling. Each section includes practical programming tasks and theoretical questions to test understanding of Python concepts. It serves as a study guide for individuals looking to reinforce their Python knowledge and skills.

Uploaded by

sangam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Top 100 Python Revision Questions

1. Syntax, Variables, Data Types

1. What are the rules for naming variables in Python?

2. How do you check the type of a variable?

3. Explain dynamic typing in Python.

4. What is the difference between `is` and `==`?

5. How do you take user input and convert it to an integer?

6. What is type casting? Give examples.

7. Explain the difference between mutable and immutable types.

8. Write a program to swap two variables using a temporary variable.

9. Write a program to swap two variables without using a third variable.

10. What are Python's built-in data types?

2. Data Structures: List, Tuple, Set, Dict

1. How do you create a list?

2. How to append, insert, and remove elements from a list?

3. Difference between `pop()` and `remove()` in a list?

4. How to sort a list in ascending and descending order?

5. Write a program to find the largest element in a list.

6. What is the difference between a list and a tuple?

7. How to convert a list to a tuple and vice versa?

8. Can you modify elements of a tuple? Why or why not?

9. When would you prefer using a tuple over a list?

10. How do sets handle duplicate elements?

11. Write a program to find the union and intersection of two sets.

12. How to add and remove elements from a set?

13. What is the difference between `discard()` and `remove()` in sets?

14. How do you create a dictionary?

15. Write a program to count the frequency of elements using a dictionary.

16. How to update and delete dictionary entries?

17. How to loop through dictionary keys and values?

18. Difference between `get()` and direct access in a dictionary.

19. What is `defaultdict`?


3. Conditional Statements & Loops

1. Write a program to check whether a number is even or odd.

2. How to use nested if-else?

3. Write a program to find the largest of three numbers.

4. Difference between `break`, `continue`, and `pass`.

5. What does the `else` block do in a `for` or `while` loop?

6. Write a program to print numbers 1 to 10 using `while` loop.

7. Write a program to print all even numbers in a range using `for` loop.

8. Write a program to print the reverse of a number.

9. How does Python handle `range()` in loops?

10. Difference between `for` and `while` loop?

4. Functions & String Handling

1. What is the syntax to define a function in Python?

2. Difference between arguments and parameters.

3. What are default and keyword arguments?

4. What is the use of `*args` and `**kwargs`?

5. Write a recursive function to calculate factorial.

6. What is the scope of a variable in a function?

7. How do you reverse a string?

8. Write a program to check if a string is a palindrome.

9. How to find the number of vowels in a string?

10. Explain string slicing with an example.

11. Write a program to count the number of words in a string.

12. What are some commonly used string methods (`upper`, `lower`, `strip`, etc.)?

13. What is the difference between `isalpha()`, `isdigit()`, and `isalnum()`?

5. Object-Oriented Programming

1. What is a class and how do you create one in Python?

2. What is `__init__()` method?

3. What is `self` in Python?

4. Write a class `Student` with attributes name, roll number, and a method to display them.

5. Explain inheritance with an example.

6. What is method overriding?

7. What is encapsulation?
8. What are private and public variables?

9. What is polymorphism?

10. Write a program with multiple classes and demonstrate inheritance.

11. Difference between class variables and instance variables?

12. What are static methods and class methods?

13. What is the use of `super()`?

14. How can you implement abstraction in Python?

15. Difference between OOP in Java and Python?

6. File Handling & Exception Handling

1. How to open, read, and write to a file in Python?

2. What is the difference between `w`, `r`, `a`, and `x` modes?

3. Write a program to read content from a text file line by line.

4. Write a program to count words in a file.

5. How to use `with open()` context manager?

6. What is the purpose of exception handling?

7. How to use `try-except` in Python?

8. What is the use of `finally` block?

9. Write a program to catch a divide-by-zero error.

10. How to raise your own exception?

7. Practice Coding Questions

1. Check if a number is prime.

2. Generate Fibonacci series up to n terms.

3. Reverse a list without using `reverse()`.

4. Find the factorial of a number using a loop.

5. Find the largest and smallest elements in a list.

6. Count occurrences of each element in a list using dictionary.

7. Write a program to sort a list of tuples by second element.

8. Check if a string is an anagram.

9. Find common elements between two lists.

10. Merge two dictionaries.

11. Find the second largest number in a list.

12. Convert Celsius to Fahrenheit.

13. Print multiplication table for a number.


14. Remove duplicates from a list.

15. Convert a number to binary, octal, and hexadecimal.

16. Check if a year is a leap year.

17. Count the number of digits in a number.

18. Find GCD and LCM of two numbers.

19. Check if a number is a perfect number.

20. Create a mini calculator using functions (`+`, `-`, `*`, `/`).

You might also like