Attempt Any: Six Question(s) 5 Marks
Attempt Any: Six Question(s) 5 Marks
Attempt Any: Six Question(s) 5 Marks
– 3)
Programming in Python
Subject Code: BTCS 510-18
MST -11
Que 1. Create a wrapper for the open() function. When a program opens a file successfully, a file handle
will be returned. If the file open fails, rather than generating an error, return None to the callers so
that they can open files without an exception handler.
Que 2. Describe the need for catching exceptions using try and except statements.
Que 3. Suppose there are three modules m1.py, m2.py, m3.py, containing function f1(), f2(), and f3()
respectively. How will you use those function in your program?
Que 4. (a) what is the difference between a module & a package.
(b) what is the purpose behind creating multiple packages and modules?
Que 5. Why do you need regular expressions in Python? Consider a file “ait.txt”. Write a Python program
to read the file and look for lines of the form X-DSPAM-Confidence: 0.8475 X-DSPAM-
Probability: 0.458 Extract the number from each of the lines using a regular expression. Compute
the average of the numbers and print out the average.
Que 6. With the help of Label & Button Widget write a script to create three buttons and perform the
following operation on that Pressing any of the three buttons will result in changing the text label
so that it will then contain the text of the Button (widget) that was pressed.
Que 7. Take any existing database table, and use the knowledge you developed from Database
Programming and output the contents of a database table into an HTML table.
Note:
Any student found attempting answer sheet from any other person(s), using incriminating material
or involved in any wrong activity reported by evaluator shall be treated under UMC provisions.
Student found sharing the question paper(s)/answer sheet on digital media or with any other person
or any organization/institution shall also be treated under UMC.
Any student found making any change/addition/modification in contents of scanned copy of
answer sheet and original answer sheet, shall be covered under UMC provisions.
IN Case of UMC: All MST will be Cancelled and no Internal Mark’s will be Awarded.