0% found this document useful (0 votes)
3 views6 pages

Question Bank Python

The document is a comprehensive question bank covering three units: Python Basics and Data Types, Object-Oriented Programming, and File Handling and Exception Handling. It includes theoretical questions, definitions, and practical programming tasks related to Python. Each unit is structured to enhance understanding of fundamental concepts and applications in Python programming.

Uploaded by

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

Question Bank Python

The document is a comprehensive question bank covering three units: Python Basics and Data Types, Object-Oriented Programming, and File Handling and Exception Handling. It includes theoretical questions, definitions, and practical programming tasks related to Python. Each unit is structured to enhance understanding of fundamental concepts and applications in Python programming.

Uploaded by

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

Question Bank

Unit 1: Python Basics and Data Types**


1. What is the Python interpreter, and how does it work?
2. List the arithmetic operators available in Python.
3. Define a variable in Python.
4. What is the difference between == and = in Python?
5. Name the three types of control structures in Python.
6. What is the purpose of the break statement in a loop?
7. List the basic data types in Python.
8. What is the difference between a list and a tuple?
9. Define a dictionary in Python.
10. What is a docstring, and how is it written?
11. Name the two modes of executing Python code.
12. What is the purpose of the continue statement?
13. List the types of loops available in Python.
14. What is the difference between int and float data types?
15. What is the purpose of the pass statement?
16. Define a module in Python.
17. What is the scope of a variable in Python?
18. Name the built-in functions used for numerical operations.
19. What is the purpose of the format() method in strings?
20. What is Unicode, and why is it used in Python?
21. Explain the difference between script mode and interactive mode in Python.
22. How does Python handle dynamic typing?
23. Explain the concept of coercion in Python with an example.
24. How are lists and sets different in terms of mutability and uniqueness?
25. Describe the use of command-line arguments in Python.
26. Explain the difference between if, elif, and else statements.
27. How does Python handle nested loops?
28. Explain the concept of recursion with an example.
29. How are dictionaries different from lists in terms of data storage?
30. What is the significance of indentation in Python?
31. Explain the difference between local and global scope.
32. How does Python handle memory management for variables?
33. Explain the use of the range() function in loops.
34. How does Python handle string formatting using f-strings?
35. What is the purpose of the import statement in Python?
36. Explain the difference between append() and extend() methods in lists.
37. How does Python handle type conversion between integers and floats?
38. Explain the concept of list comprehension with an example.
39. What is the purpose of the zip() function in Python?
40. How does Python handle multi-line strings?
41. Write a Python program to swap two numbers without using a temporary
variable.
42. Write a Python script to find the largest number in a list.
43. Write a program to check if a string is a palindrome.
44. Write a Python function to calculate the factorial of a number using recursion.
45. Write a program to count the frequency of each element in a list.
46. Write a Python script to reverse a string without using built-in functions.
47. Write a program to print the Fibonacci series up to a given number.
48. Write a Python script to remove duplicates from a list.
49. Write a program to sort a dictionary by its values.
50. Write a Python script to read command-line arguments and print them.
Unit 2: Object-Oriented Programming
1. Define a class in Python.
2. What is an object in Python?
3. List the four principles of Object-Oriented Programming (OOP).
4. What is the purpose of the __init__ method in a class?
5. Define polymorphism in Python.
6. What is encapsulation in OOP?
7. What is the difference between a modifier and an accessor method?
8. Define inheritance in Python.
9. What is a static method in Python?
10. What is the purpose of the self keyword in Python?
11. Define composition in Python.
12. What is an abstract data type?
13. Name the built-in functions used for classes in Python.
14. What is the purpose of the super() function?
15. Define method overriding in Python.
16. What is the difference between a class method and an instance method?
17. What is the purpose of the __str__ method in a class?
18. Define a constructor in Python.
19. What is the purpose of the __del__ method?
20. What is the difference between single and multiple inheritance?
21. Explain the concept of abstraction in OOP.
22. How does Python support polymorphism?
23. Explain the difference between composition and inheritance.
24. How does encapsulation improve code security?
25. Explain the concept of method overloading in Python.
26. How does the super() function work in inheritance?
27. Explain the difference between instance variables and class variables.
28. How does Python handle multiple inheritance?
29. Explain the concept of operator overloading in Python.
30. How does Python handle dynamic method addition?
31. Explain the use of the @staticmethod decorator.
32. How does Python handle method resolution order (MRO)?
33. Explain the concept of abstract base classes in Python.
34. How does Python handle private and protected members?
35. Explain the use of the __new__ method in Python.
36. How does Python handle garbage collection for objects?
37. Explain the concept of duck typing in Python.
38. How does Python handle the __init__ method in inheritance?
39. Explain the use of the @classmethod decorator.
40. How does Python handle the __call__ method?
41. Write a Python program to create a class representing a bank account.
42. Write a program to demonstrate single inheritance in Python.
43. Write a Python script to implement method overriding.
44. Write a program to demonstrate polymorphism using a function.
45. Write a Python script to implement operator overloading.
46. Write a program to create a class with static and instance methods.
47. Write a Python script to demonstrate composition.
48. Write a program to implement multiple inheritance in Python.
49. Write a Python script to create an abstract base class.
50. Write a program to demonstrate the use of the __str__ method.
Unit 3: File Handling, Exception Handling, and Applications
1. What is the purpose of file handling in Python?
2. List the modes used to open a file in Python.
3. Define an exception in Python.
4. What is the purpose of the try-except block?
5. Name the Python library used for data visualization.
6. What is the purpose of the finally block in exception handling?
7. Define a CSV file.
8. What is the purpose of the with statement in file handling?
9. Name the Python library used for data manipulation.
10. What is the purpose of the readlines() method?
11. Define a database cursor in Python.
12. What is the purpose of the os module in Python?
13. Name the Python library used for numerical computations.
14. What is the purpose of the json module in Python?
15. Define a pickle file in Python.
16. What is the purpose of the seek() method in file handling?
17. Name the Python library used for machine learning.
18. What is the purpose of the raise keyword in Python?
19. Define a context manager in Python.
20. What is the purpose of the pandas library?
21. Explain the difference between read() and readline() methods.
22. How does Python handle file closing using the with statement?
23. Explain the concept of exception propagation in Python.
24. How does Python handle multiple exceptions in a single try block?
25. Explain the use of the matplotlib library for plotting graphs.
26. How does Python handle reading and writing CSV files?
27. Explain the concept of database connectivity in Python.
28. How does Python handle JSON data serialization and deserialization?
29. Explain the use of the pickle module for object serialization.
30. How does Python handle file pointer manipulation using seek()?
31. Explain the concept of data frames in the pandas library.
32. How does Python handle custom exceptions?
33. Explain the use of the os module for directory operations.
34. How does Python handle file renaming and deletion?
35. Explain the concept of data visualization using seaborn.
36. How does Python handle database transactions?
37. Explain the use of the numpy library for numerical computations.
38. How does Python handle file compression using the zipfile module?
39. Explain the concept of logging in Python.
40. How does Python handle large datasets using pandas?
41. Write a Python program to read and display the contents of a file.
42. Write a program to handle division by zero using exception handling.
43. Write a Python script to plot a line graph using matplotlib.
44. Write a program to read and write data to a CSV file.
45. Write a Python script to connect to a database and fetch records.
46. Write a program to serialize and deserialize data using the json module.
47. Write a Python script to handle file renaming using the os module.
48. Write a program to create a bar chart using seaborn.
49. Write a Python script to handle custom exceptions.
50. Write a program to perform data analysis using the pandas library.
51. Write a Python script to read a file line by line.
52. Implement a Python program to copy contents from one file to another.
53. Write a Python function to count the number of words in a file.
54. Develop a program to handle ZeroDivisionError.
55. Implement a Python program to store and retrieve data from a database.

You might also like