ACADEMIC YEAR (2024-2025) EVEN SEMESTER SUBJECT
CODE : 24ESC111 YEAR/SEMESTER : I/II
SUBJECT TITLE : Problem Solving And DEPARTMENT : ECE (SEC-I)
Python Programming
QUESTION BANK – UNIT 5
PART - A (2 MARKS)
S.No. Question Bloom's Level
1 Write the syntax for opening a file to write in binary mode. Apply
2 What are the different modules in Python? Remember
3 How do you delete a file in Python? Understand
4 How do you use command line arguments to give input to the Understand
program?
5 Write the significance of the format operator. Remember
6 How are exceptions handled in Python? Understand
7 List any four file operations. Remember
8 Write a Python program to count words in a sentence using the Apply
split() function.
9 What is a module and package in Python? Remember
10 List a few common exception types. Remember
11 List the file opening modes. Remember
12 List the different ways to read a file. Remember
13 What is the difference between append and write mode? Understand
14 What are the attributes of file objects? Remember
15 List the methods in file objects. Remember
16 Differentiate Errors and Exceptions. Understand
17 Illustrate try-except-else. Understand
18 Give the mechanism to handle exceptions. Understand
19 Compare packages and modules. Understand
20 Write a program to read a file. Apply
21 Explain command line arguments with example. Understand
22 What is the format operator used for? Understand
23 What is a package in Python? Remember
24 List the built-in modules in Python. Remember
25 Give example for format operator. Apply
PART - B ( 16 MARKS)
S.No. Question Bloom's Level
1 Name the different access modes for opening a file and present an Understand
outline of the same.
2 a) What is an exception? Elaborate on exception handling in Apply
Python. (8)
b) Write a program to concatenate the contents of two files into a
single file. Get input for two files from the user and
concatenate them. (8)
3 a) Write a function that copies a file, reading and writing up to 50 Apply
characters at a time. (8)
b) Write a Python program to count the number of lines, words,
and characters in a text file. (8)
4 a) How will you create a Package & import it? Explain it with an Understand
example program. (10)
b) What are the two types of files? Explain different file
operations. (6)
5 a) Explain in detail Python files, their types, functions, and Understand
operations that can be performed on files with examples. (12)
b) Differentiate between Python Modules and Packages. (4)
6 a) Write a simple Python program to count the number of words Apply
in a sentence using the split() method and list other count
methods. (12)
b) What are command-line arguments in Python? (4)
7 a) Write a Python program to implement stack operations Apply
using modules. (8)
b) List out the types of Modules and explain any two types in
detail. (8)
8 a) Write a program to enter a number in Python and print its octal Apply
and hexadecimal equivalent. (8)
b) Explain in detail about namespaces and scoping. (8)
9 a) Why does Python require file handling? Explain Understand
opening files in Python with all modes. (10)
b) Write a Python program to count the number of words in a text
file. (6)
10 a) Give brief notes on Python Exception Handling using try, Understand
except, raise, and finally statements. (10)
b) Write a Python program for voters age validation. (6)
FACULTY IN-CHARGE HOD DEAN-CSE