GURU NANAK DEV ENGINEEERING COLLEGE, BIDAR
585403
Affiliated to VTU Belgaum & approved by AICTE New Delhi
Department of Computer Science and Engineering
Assignment – II SUB CODE: BPLCK105
1. With code snippet, explain saving variables using the shelve module and
pprint.pformat() functions.
2. Explain the Password Locker Project with a code snippet.
3. Explain the concept of file path. Also, discuss absolute and relative paths.
4. Explain the following functions with example:
i) makedirs() ii) getcwd() iii) velpath( ) iv) listdir() v) sub()
5. Write a Python program to demonstrate the file reading and writing process.
6. Define assertions. Explain how assertions can be used in traffic light simulation with
Python code snippet.
7. Briefly explain assertions & raising an exception.
8. List out the difference between shultil.copy () and shutil.copytree () method and
Explain in brief move, rename, and deleting files and folders.
9. Explain the following file operations in python with suitable example: i) Copying files
& folder ii) Moving files & folders iii) Permanently deleting files & folders.
10. List out the benefits of compressing the file? Also explain reading of a zip file with an
example.
11. Develop a program to backing Up a given Folder (Folder in a current working directory)
into a ZIP File by using relevant modules and suitable methods. Explain the process.
12. Explain in detail (i)Logging (ii)Buttons in Debugging (iii)raising Exceptions.
13. Develop a Python program to traverse the current directory by listing subfolders and
files.
14. Write a function named DivExp which takes TWO parameters a and, b, and returns a
value c (c=a/b). Write a suitable assertion for a>0 in function DivExp and raise an exception
for when b=0. Develop a suitable program that reads two values from the console and calls a
function DivExp.
15. What is a class? How to define a class in Python? How to initiate a class and how the
class members are accessed? Explain with programming snippets.
16. Illustrate the concept of modifier and pure functions with Python snippets.
GURU NANAK DEV ENGINEEERING COLLEGE, BIDAR
585403
Affiliated to VTU Belgaum & approved by AICTE New Delhi
Department of Computer Science and Engineering
17. Develop a program that uses class Student which prompts the user to enter marks in
three subjects calculates total marks, and percentages, and displays the scorecard details. [Hint:
Use a list to store the marks in three subjects and total marks. Use __init__() method to initialize
the name, USN, and the lists to store marks and total, Use getMarks() method to read marks
into the list, and display() method to display the score card details.]
18. Explain __init__, __str__ methods and also explain ‘prototype and patch’ with suitable
example.
19. Write a function called print time that takes a time object and prints it in the form hour
: minute: second.
20. Define polymorphism. Explain polymorphism with an example.