Unit 3
Unit 3
Program: CO6I
Course: Programming with Python (PWP)(22616)
Unit-III:Data Structures in python
Course Outcome(COc): Perform operations for data structures in Python
Unit Outcomes(UO):
U3-3a: Write a Python program to use and manipulate lists for the given problem . Apply
U3-3b: Write a Python program to use and manipulate tuples for the given problem Apply
U3-3c: Write a Python program to use and manipulate sets for the given problem Apply
U3-3d: Write a Python program to use and manipulate dictionaries for the given problem Apply
Unit
Questions
Sr. No. R/ U/ A Level Outcomes
Explain about methods in Lists of Python with appropriate Understand,
1 UO-3a
examples. Apply
Write a python program to describe different ways of deleting
2 Apply UO-3a
an element from the given List.
What are the different operations that can be performed on a Understand,
3 UO-3a
list? Explain with examples. Apply
Understand,
4 Write in brief about List in python. UO-3a
Apply
Write in brief about Tuple in python. Write operations with Understand,
5 UO -3b
suitable examples. Apply
Write in brief about Set in python. Write operations with Understand,
6 UO -3c
suitable examples. Apply
Write in brief about Dictionary in python. Write operations Understand,
7 UO -3d
with suitable examples. Apply
Write in brief about Sequence in python. Write operations Understand,
8 UO -3a
with suitable examples. Apply
9 Compare List and Tuple. Remember UO -3b, 3b
UO -3a, 3b,
10 Give a comparison between lists, tuples, dictionaries and sets. Remember
3c, 3d
Write a Python program that prints the intersection of two
11 Apply UO - 3a
lists. ( without using list comprehension/sets)
Understand,
12 What is a list in Python? How to create nested lists? UO - 3a
Apply
13 Describe any four methods of lists in Python Understand UO - 3a
Write a Python program that counts the number of
14 Apply UO -3d
occurrences of a letter in a string, using dictionaries.
Understand,
15 How to access values in a dictionary? UO -3d
Apply
16 What are built-in dictionary functions? Explain. Understand UO -3d
17 Describe has_key( ) method with example. Understand UO -3d
Show the output for the following:
1. >>> a=[1,2,3]
>>>b=[4,5,6]
>>> c=a+b
18 >>> print(c) Apply UO-3a
2. >>>print(a*3)
3. >>>t=[‘a’,’b’,’c’,’d’,’e’,’f’]
>>>t[1:3]=[‘x’,’y’]
>>>print (t)
19 Discuss about list and dictionary comprehensions. Understand UO -3a, 3d
20 Use of any four methods of tuple in python? Understand UO - 3b
21 What is cloning of List? How is it done? Understand UO -3a
22 What is the use of all(), any(), cmp() and sorted() in dictionary?Understand UO -3d
23 Explain the List Slicing and List Mutability. Understand UO -3a
24 Describe Set in python with suitable examples. Apply UO -3c
Illustrate the following Set methods with an example. a)
Understand,
25 intersection() b) union() c) issubset() d) difference() e) UO -3c
Apply
update() f) discard()
What is the difference between copy.copy( ) and copy.
Understand,
26 deepcopy( ) functions applicable to a List or Dictionary in UO -3a, 3d
Apply
Python? Give suitable examples for each.
Write a program to input any two tuples and interchange the
27 Apply UO - 3b
tuple variable
Discuss the following Dictionary methods in Python with
Understand,
28 examples. UO -3d
Apply
(i) get() (ii) items() (iii) keys() (iv) values() (v) update()
Explain the methods of List data type in Python for the
following operations with suitable code snippets for each.
(i) Adding values to a list ii) Removing values from a list Understand,
29 UO -3a
Apply
(iii) Finding a value in a list iv) Sorting the values in a list
(v) Adding values to a list: