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

22CS104-1

This document outlines the examination structure for a Python Programming course, including two sections with various questions. Section A consists of four questions requiring the design and implementation of functions for data handling, string manipulation, random number processing, and list operations. Section B includes two questions on file operations and error handling in Python, requiring explanations and algorithm implementations.

Uploaded by

devaraj48212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

22CS104-1

This document outlines the examination structure for a Python Programming course, including two sections with various questions. Section A consists of four questions requiring the design and implementation of functions for data handling, string manipulation, random number processing, and list operations. Section B includes two questions on file operations and error handling in Python, requiring explanations and algorithm implementations.

Uploaded by

devaraj48212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Regulation: R22 Code: 22CS104/1

II B. Tech. I Semester Regular Examinations – January, 2023


PYTHON PROGRAMMING
Time: 150 Min (CSE) Max. Marks: 80M

SECTION – A
Answer all Four questions 4×10M=40M

1. Design a table to store the details of students such as name, marks obtained in
various courses (P&S, DS, DBMS and PP). Design and implement the functions to
perform the following operations.
a) Find the details of students who secured first 5 ranks.
b) Find the details of students who got less than 40% of marks(Fail) in all the
courses.
c) Find the details of students who failed in a given course.
d) Find the average score and standard deviation in a given course.
e) Display the students who have passed all the subjects he/she attempted.
2. A paragraph comprises of two or more sentences. Each sentence in a paragraph is
terminated by a delimiter, Full stop (.). Design and implement the functions to
perform the following operations on a given paragraph.
a) Count the number of words that begins with uppercase letter.
b) Find the presence of a given word or string.
c) Find the line index of the first occurrence of a given string/word.
d) Count the frequency of a specific character.
e) Capitalize the first character of all the words.
f) Convert the paragraph into a vector of word:counts.
3. Create a list L of n random numbers using random functions within the range 0 to
10000. Design and implement the functions to perform the following.
Create different lists to store
a) All prime numbers.
b) All palindrome numbers.
c) Armstrong numbers: Armstrong number is a number, which forms the total
of the same number, where each of its digits is raised to the power of the
number of digits in the given number.
d) Strong numbers: Strong number is a number whose sum of the factorial of
digits is equal to the original number.
4. Design and Implement the following operations on a list data structure. Do not use
list built-in functions.
a) Function to insert one or multiple data items at the end of the list.
b) Function to insert a data item at a given index.
c) Function to remove a data item from the specified index.
d) Function to remove the first occurrence of a given data item.
e) Function to remove the last occurrence of a given data item.
f) Function to remove all duplicate elements.

1 of 2
Regulation: R22 Code: 22CS104/1
SECTION-B
Answer all Two questions 2×20M=40M
5. A) What is a file? What are the various types of files? What are the file operations
that Python Programming language supports? Describe the modes in which the
files can be opened to perform various operations?
B) Design and implement algorithms to perform the following operations.
a) Line_count (): Find the number of lines in a Text File.
b) Find_largest(): Find the largest word.
c) Words_characters (): Count the number of words and characters in a file.
d) Delete (): Remove the specific line and return the deleted line.
e) Append (): Append one or more lines at the end of the text file.
f) Copy (): Create a copy of a given file.
g) Word_frequency(): Create a dictionary to store the word and its frequency
from a file.
h) Article_Frequency (): Create a dictionary to store the frequency of articles.

6. A) Assume that a given Python program has no syntax errors. However, the
execution of the program got terminated by printing an error message. Explain
the reason behind and how to handle such kind of runtime issues.

B) Write a python program in which the following exceptions will arise. The
program should also include the handlers for these exceptions.
a) Zero_division_Error(): throw the error which raises zero division error and
address how to handle it.
b) File_Not_found_error(): throw the error which raises file not found error
and address how to handle it.
c) Type_Error(): throw the error which raises type error and address how to
handle it.
d) Name_Error(): throw the error which raises Name error and address how to
handle it.
e) Index_Error(): throw the error which raises index error and address how to
handle it.
f) Value_error: (): throw the error which raises value error and address how to
handle it.
g) Module_Not_found_Error: (): throw the error which raises module not
found error and address how to handle it.

2 of 2

You might also like