0% found this document useful (0 votes)
4 views4 pages

Python Assignment2.Docx

This document is an assignment outline for the Introduction to Python Programming course at Atria Institute of Technology. It includes course outcomes and a list of questions covering various Python programming concepts such as file handling, object-oriented programming, and regular expressions. Each question is associated with specific learning objectives and marks for evaluation.

Uploaded by

rockaravindr
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)
4 views4 pages

Python Assignment2.Docx

This document is an assignment outline for the Introduction to Python Programming course at Atria Institute of Technology. It includes course outcomes and a list of questions covering various Python programming concepts such as file handling, object-oriented programming, and regular expressions. Each question is associated with specific learning objectives and marks for evaluation.

Uploaded by

rockaravindr
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/ 4

Atria Institute of Technology, Bangalore

Dept of CSE
Assignment 2

Semester - II Sem Subject-Introduction to Python Programming

Date: 2-6-25 Faculty- Dr. Farhana Kausar

Course Outcome

CO1 Demonstrate proficiency in handling loops and creation of functions.


CO2 Identify the methods to create and manipulate lists, tuples and dictionaries.
CO3 Develop programs for string processing and file organization
CO4 Interpret the concepts of Object-Oriented Programming as used in Python

S No Questions (Refer these questions for test) BTL CO Marks

1 illustrate with an example opening of a file with open() function, 2 3 8


reading the contents of file with read() and writing to the files with
write() function

2 differentiate between absolute path and relative path 2 3 6

3 explain the role of os module in python 2 3 4

4 explain the following 2 3 6


i. os.path.abspath(path)
ii. os.path.isabs(path)
iii. os.path.relpath(path, start)

5 write a python program to check for file and directory using 3 3 5


appropriate methods

6 write a program to read and write on files also perform read 3 3 7


operation to read certain amount of characters from file

7 explain the shelve module in python. list the advantages of shelve 2 3 7


module

8 write a python program to perform following operations on shelve 3 3 8


i. opening a shelf
ii. storing the data
iii. retrieving the data
iv. deleting the data

9 write a program to sort the contents of a text file and write the sorted 3 3 8
contents into a separate text file.
10 explain shutil module 2 3 3

Differentiate between shutil.copy() and shutil.copytree() with


examples.

11 Differentiate between shutil.copy() and shutil.copytree() with


examples.

12 explain different methods for copying files 2 3 6

13 explain the following operations in python with suitable example 2 3 9


i. copying files and folders
ii. moving files and folders
iii. permanently deleting files and folders

What is the use of send2trash? How is it safer than


shutil.rmtree()?

14 write a python program to use copy, move methods to perform 2 3 10


operations on files & directory

15 What is the use of send2trash? How is it safer than


shutil.rmtree()?

15 Develop a program to backing Up a given Folder (Folder in a 2 3 6


current working directory) into a ZIP File by using relevant
modules and suitable methods.

16 write a python program to traverse the current directory by


listing

17 What are regular expressions? list all the regular expressions in 2 3 6


python

18 write a python program to create a file with American date 2 3 6


format

19 explain the concept of assertions in python 2 3 5

20 Compare the use of raise and assert in Python.

Compare the use of raise and assert in Python.

21 Write a function named DivExp which takes TWO parameters 3 3 5


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.

22 write a python program to find the average of a list. Use 3 3 5


assestions if the list is empty.

23 Illustrate the logging levels in python 2 3 6


24 write a python program to find factorial of a number using 3 3 8
logging module

25 write a python program to print cats = [{'name': 'Zophie', 'desc': 3 3 5


'chubby'}, {'name': 'Pooka', 'desc': 'fluffy'}]. use the appropriate method

26 what is a class? how to define a class. how to initiate a class and to 2 4 5


how are class members accessed

27 What are breakpoints? How do they help during debugging in


IDLE? What is the full form of IDLE give examples?

28 define pure function. Illustrate with an example 2 4 6

29 Define a function which takes TWO objects representing complex 3 4 7


numbers and returns new complex number with a addition of two
complex numbers. Define a suitable class ‘Complex’ to represent
the complex number. Develop a program to read N (N >=2)
complex numbers and to compute the addition of N complex
numbers.

30 Develop a program that uses class Student which prompts the user 3 4 7
to enter marks in three subjects and calculates total marks,
percentage and displays the score card details.

31 explain the concept of printing objects 2 4 6

32 explain - - init()- - and - - str()- - methods with example 2 4 8

33 differentiate between pure and impure functions 2 4 6

34 explain prototyping and planning 2 4 6

35 explain the concept of operator overloading 2 4 6

36 write a program to count the number of times each letter appears in 3 4 5


a word

37 Write a program that takes a birthday as input and prints the user’s 3 4 5
age and the number of days, hours, minutes and seconds until their
next birthday.

38 For two people born on different days, there is a day when one is 3 4 10
twice as old as the other. That’s their Double Day. Write a program
that takes two birth dates and computes their Double Day.

39 write a Python program to Find day of the week for a given date 3 4 5

40 write a python program to find if a point lies on or inside a rectangle 3 4 5


or not using classes

41 Write a program that searches a directory and all of its 3 4 7


subdirectories, recursively, and returns a list of complete paths for
all files with a given suffix (like .txt)

42 Write a function named point_in_circle that takes a Circle and a 3 4 7


Point and returns True if the Point lies in or on the boundary of the
circle

43 Write a function named rect_in_circle that takes a Circle and a 3 4 7


Rectangle and returns True if the Rectangle lies entirely in or on the
boundary of the circle.

44 Create a Python program that simulates a number guessing 3 4 7


game. The program should randomly select an integer between
1 and 10. The user must guess the number, and the program
should provide feedback on whether the guess is too low, too
high, or correct. The game continues until the user guesses the
correct number and then displays the total number of attempts
taken.

You might also like