50% found this document useful (2 votes)
3K views1 page

Module 2 Questions

Uploaded by

Sanjana ML
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
50% found this document useful (2 votes)
3K views1 page

Module 2 Questions

Uploaded by

Sanjana ML
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/ 1

National Education Society (R.

)
J N N College of Engineering, Shivamogga
(Approved by AICTE, New Delhi, Certified by UGC 2f & 12B, Accredited by NAAC –‘B’,
UG programs:CE,ME,EEE,ECE,CSE,ISE,TCE acredited by NBA:1.7.2022 to 30.6.2025,
Recognized by Govt. of Karnataka and Affiliated to VTU, Belagavi)
Department of Electronics & Communication Engineering

Course: Introduction to Python Programming Couse Code: BPLCK205B


Module 2
Question Bank

CO mapped: CO2-Identify the methods to create and manipulate lists, tuples, and dictionaries.

Q.N. Questions Marks


1. What is a list? Explain the methods that are used to insert and delete items from the list. 8
2. Explain the methods of List data type in Python for the following operations with suitable code snippets 8
for each.
(i) Adding values to a list. ii) Removing values from a list
(iii) Finding a value in a list. iv) Sorting the values in a list
3. Explain negative indexing, slicing, index(), append(), remove(), pop(), insert() and sort() with suitable 8
example.
4. Explain the following methods in lists with an examples: 8
i) len() ii)sum() iii) max() iv)min()
5. Explain different ways to delete an element from a list with suitable Python syntax and programming 6
examples.
6. What is the difference between copy.copy( ) and copy.deepcopy( ) functions applicable to a List or 6
Dictionary in Python? Give suitable examples for each.
7. Explain the use of in and not in operators in list with suitable examples. 6
8. How is the dictionary different from list? Assume a dictionary containing city and population as key and 6
value respectively. Write a program to traverse the dictionary and display most populous city.
9. How is tuple different from a list and which function is used to convert list to tuple. 5
10. Explain set() and setdefault() method in a dictionary . 6
11. Discuss the following Dictionary methods in Python with examples. 8
(i) get() (ii) items() (iii) keys() (iv) values()
12. Explain different ways to delete an element from a list with suitable Python syntax and programming 7
examples.
13. If S= ‘Hello World’ , explain and write the output of the following statements: 4
i) S[1:5] ii) S[:5] iii) S[3:-1] iv) S[:]
14. What is Dictionary in Python? How is it different from List data type? Explain how a for loop can be used 6
to traverse the keys of the Dictionary with an example.
15. Write a python program to accept n numbers and store them in a list. Then print the list without ODD 6
numbers in it.
16. For a=[‘hello’, ‘how’, [1,2,3], [[10,20,30]]] what is the output of following statement (i) print( a[ : : ] ) (ii) 6
print(a[-3][0]) (iii) print(a[2][ : -1]) (iv) print(a[0][ : : -1])
17. Write a python program to read dictionary data and delete any given key entry in the dictionary. 4
18. Using string slicing operation write python program to reverse each word in a given string (eg: input: “hello 6
how are you”, output: “olleh woh era uoy”)
19. Using string slicing operation write python program to reverse the sentence in a given string (eg: input: 6
“hello how are you”, output: “uoy era woh olleh”)
20. Write a program to create a list of number and display the count of even and odd numbers in the list. 6
21. Read a multi-digit number (as chars) from the console. Develop a program to print the frequency of each 6
digit with suitable message.
22. Write a Python program that accepts a sentence and find the number of words, digits, uppercase letters 4
and lowercase letters.
23. Develop a program to find mean, variance and standard deviation. 6
24. Write a program to take a sentence as input and display the longest word in the given sentence. 6
25. Create a function to print out a blank tic-tac-toe board. 7

You might also like