0% found this document useful (0 votes)
7 views2 pages

Python Module 4 and 5 Qbank

The document is a question bank for an Introduction to Python Programming course, covering topics such as file handling, Excel automation using openpyxl, and object-oriented programming concepts. It includes questions on file properties, methods for file operations, and practical programming tasks related to reading and writing files, as well as class definitions and polymorphism. The document is divided into two modules, with Module-4 focusing on file operations and Excel tasks, and Module-5 addressing object-oriented programming and function definitions.
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)
7 views2 pages

Python Module 4 and 5 Qbank

The document is a question bank for an Introduction to Python Programming course, covering topics such as file handling, Excel automation using openpyxl, and object-oriented programming concepts. It includes questions on file properties, methods for file operations, and practical programming tasks related to reading and writing files, as well as class definitions and polymorphism. The document is divided into two modules, with Module-4 focusing on file operations and Excel tasks, and Module-5 addressing object-oriented programming and function definitions.
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/ 2

Introduction To Python Programming

Question Bank

Module-4
1. What are the key properties of a file? Explain in detail file reading/writing process
with an example of python program
2. With code snippet, Explain saving variables using the shelve module and pprint
pfromat() functions.
3. Explain how to find the size of file and display the contents of file. Write a program to
calculate the total size of all the files present in a folder specified by the user.
4. Discuss the different paths in the file system
5. Explain in briefly, what are the different methods of file operations supports in python
shutil module.
6. Explain the steps in project Generating Random Quiz Files
7. Write a python program to accept a filename from the user (i) Display the first N-lines
of the file (ii) Find the frequency of occurrence of the word accepted from the user in
the file
8. Explain with an example the syntax of read (), write () methods for a file.
9. List and explain the ways to specify the file path and how to handle them using os.path
module.
10. What is a workbook in Excel, and how is it structured in terms of sheets, rows, and
columns?
11. Define the role of the openpyxl library in Python. Why is it essential for automating
Excel tasks?
12. What is the purpose of the load_workbook() function in the openpyxl module? Give
an example of its usage
13. How can you retrieve all the sheet names from a workbook using openpyxl? Write the
relevant Python code
14. Explain how to access a specific cell value in a worksheet. Provide a code snippet
15. How do you differentiate between rows and columns programmatically using
openpyxl?
16. Describe the steps to convert between column letters and numbers using the
openpyxl.cell module.
17. How do you slice a worksheet to retrieve a range of cells using Python? Provide an
example.
18. Explain how to loop through all rows in a worksheet and print cell values.
19. Write the steps to create and save a new Excel workbook in Python.
20. How can you add and remove sheets from a workbook using openpyxl? Include code
examples.
21. Write a program to read data from one Excel sheet and copy it to another sheet in a
different workbook.
22. Explain a real-world scenario where automating Excel tasks using Python would be
useful.

Module-5
1. Define polymorphism. Demonstrate polymorphism with function to find histogram to
count the numbers of times each letter appears in a word and in sentence
2. What is type based dispatch? Illustrate with python program.
3. What is a class? How to define class in python? How to initiate a class and how the
class members are accessed?
4. Explain init and str method with an example python program
5. Demonstrate pure function and modifiers with examples.
6. Write a function called print time that takes a time object and print it in the form Hour:
Minute: Second
7. What is a programmer-defined type in Python, and how is it represented?
8. Explain the concept of attributes in objects with an example.
9. Define and differentiate between shallow copy and deep copy in Python.
10. What is the difference between pure functions and modifiers? Give examples.
11. Explain the prototype and patch development plan with an example.
12. Write a class Time to represent time with attributes hour, minute, and second. Include
a method print_time to print the time in hh:mm:ss format.
13. Write a function add_time that takes two Time objects and returns their sum.
14. Implement the time_to_int and int_to_time functions for converting between time
objects and integers.
15. What is operator overloading? How is it implemented in Python? Provide an example.
16. Write a method increment in the Time class that adds a given number of seconds to
the time.

You might also like