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

Ia2 QB

The document is a question bank for the Department of Computer Science & Engineering at Sai Vidya Institute of Technology, covering various Python programming topics. It includes questions on string handling methods, file operations, exception handling, logging, and class design. Additionally, it provides programming tasks that require practical application of the concepts discussed.

Uploaded by

madhukeshs0742
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)
6 views2 pages

Ia2 QB

The document is a question bank for the Department of Computer Science & Engineering at Sai Vidya Institute of Technology, covering various Python programming topics. It includes questions on string handling methods, file operations, exception handling, logging, and class design. Additionally, it provides programming tasks that require practical application of the concepts discussed.

Uploaded by

madhukeshs0742
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

Sri Sai Vidya Vikas Shikshana Samithi ®

SAI VIDYA INSTITUTE OF TECHNOLOGY


Approved by AICTE, New Delhi, Affiliated to VTU, Recognized by Govt. of Karnataka
Accredited by NBA, New Delhi (CSE, ECE. ISE, MECH & CIVIL), NAAC – “A” Grade
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
RAJANUKUNTE, BENGALURU 560 064, KARNATAKA
Phone: 080-28468191/96/97/98 * E-mail: [email protected]* URL www.saividya.ac.in

IA 2 Question Bank

1. Explain following Python string handling methods with examples: CO3 L2


(i) upper() (ii) isalnum()
(iii) join() (iv) split() (vi) endswith() (vii) ljust() (viii) rstrip()
2. Using string slicing operation write python program to reverse each word CO3 L3
in a given string (eg: input: “hello how are you”, output: “olleh woh era
uoy”)
3. Explain CO3 2
a) File path
b) Absolute and Relative Paths
4. Develop a program to sort the contents of a text file and write the sorted CO3 3
contents into a separate text file. [Hint: Use string methods strip(), len(),
list methods sort(), append(), and file methods open(), readlines(), and
write()].
5. Explain the role of shelve module in working with files. CO3 3
6. Explain the following file operations in Python with suitable example CO3 2
a) Copying files and folders
b) Moving files and folders
c) permanently deleting files and folders
7. Explain in detail Assertion and Raising an Exception with examples. CO3 3

Write a function named DivExp which takes TWO parameters a, b and


returns a value c (c=a/b). Write suitable assertion for a>0 in function
DivExp and raise an exception for when b=0. Develop a suitable program
which reads two values from the console and calls a function DivExp.
8. Explain CO3 2
a) Logging
Sri Sai Vidya Vikas Shikshana Samithi ®
SAI VIDYA INSTITUTE OF TECHNOLOGY
Approved by AICTE, New Delhi, Affiliated to VTU, Recognized by Govt. of Karnataka
Accredited by NBA, New Delhi (CSE, ECE. ISE, MECH & CIVIL), NAAC – “A” Grade
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
RAJANUKUNTE, BENGALURU 560 064, KARNATAKA
Phone: 080-28468191/96/97/98 * E-mail: [email protected]* URL www.saividya.ac.in

b) Disabling Logging
c) Logging Levels
d) MU’s Debugger ( IDLE Debugger )
9. List out the benefits of compressing a file using zipfile module. Explain CO3 2
the concept of walking a directory tree
10. Explain __init__( ) and __str__( ) methods with example CO4 2
11. Explain Operator overloading in detail with example CO4 2
12. Develop a program that uses class Student which prompts the user to CO4 3
enter marks in three subjects and calculates total marks, percentage and
displays the score card details. [Hint: Use list to store the marks in three
subjects and total marks. Use __init__() method to initialize 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.]

Course Coordinator

You might also like