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

U23cs382 Am24

This document is an examination paper for the U23CS382 - Python Programming course at Sri Eshwar College of Engineering for the April/May 2024 semester. It includes various questions on Python programming concepts, including type conversions, data structures, exception handling, and the use of libraries like NumPy and Django. The exam consists of two parts: Part A with short answer questions and Part B with detailed programming tasks.
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)
5 views4 pages

U23cs382 Am24

This document is an examination paper for the U23CS382 - Python Programming course at Sri Eshwar College of Engineering for the April/May 2024 semester. It includes various questions on Python programming concepts, including type conversions, data structures, exception handling, and the use of libraries like NumPy and Django. The exam consists of two parts: Part A with short answer questions and Part B with detailed programming tasks.
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

Register Number

Question Paper Code: 6599

Sri Eshwar College of Engineering


(An Autonomous Institution)
Approved by AICTE, New Delhi and Affiliated to Anna University, Chennai
Kondampatti (Post), Kinathukadavu (Tk), Coimbatore – 641 202

Autonomous Semester End UG/PG Degree Examinations – April/May 2024

Second Semester
B.E. – Computer Science and Engineering
(Common to B.E. – ECE, CCE and B.Tech. – IT, CSBS)
U23CS382 – Python Programming

(Regulations 2023)

Duration: 3 Hours Maximum Marks: 100

Answer ALL Questions

Part A – (10 X 2 = 20 Marks)

Q. No. Question M CO# KL


1. Compare explicit and implicit type conversions. 2 CO1 K2
2. What will be the output of the code snippet above? 2 CO1 K2
result = 0
for i in range(1, 5):
if i % 2 == 0:
result += i
else:
result -= i
print(result)
3. How will the list look when printed? 2 CO2 K2
my_list = [1, 2, 3, 4, 5]
my_list.pop()
my_list.append(6)
print(my_list)
4. Predict the output of the code: 2 CO2 K2
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict['d'] = my_dict.get('c') + my_dict.get('b')
print(my_dict['d'])
5. List few exception handling methods in Python with its use. 2 CO3 K1

Page 1 of 4
SECE/CoE/QPT/002/Rev. 00/03.05.2022
6. Write a Python program to read first n lines of a file. 2 CO3 K2
7. Illustrate the use of constructor in Python 2 CO4 K1
8. Compare SQL and Mongodb. 2 CO4 K2
9. Differentiate Line Plot and Bar Plot in Python. 2 CO5 K2
10. List steps to fill missing data in Python. 2 CO5 K1

Part B – (5 X 16 = 80 Marks)
11 a) (i) List Python operators and their associativity and precedence. 8 CO1 K2
(ii) Write a Python program to calculate a dog's age in dog 8 CO1 K3
years.
Note: For the first two years, a dog year is equal to 10.5
human years. After that, each dog year equals 4 human
years.
Expected Output:
Input a dog's age in human years: 15
The dog's age in dog's years is 73
(Or)
11 b) (i) Write a Python program to construct the following pattern, 8 CO1 K3
using a nested for loop.

*
**
***
****
*****
****
***
**
*
(ii) Explain the difference between mutable and immutable data 8 CO1 K2
types in Python. Give examples of each and discuss why
mutability is important in programming.

12 a) (i) Write a Python program to find items starting with a specific 8 CO2 K3
character from a list.
Expected Output:
Original list:

Page 2 of 4
SECE/CoE/QPT/002/Rev. 00/03.05.2022
['abcd', 'abc', 'bcd', 'bkie', 'cder', 'cdsw', 'sdfsd', 'dagfa',
'acjd']
Items start with a from the said list:
['abcd', 'abc', 'acjd']
Items start with d from the said list:
['dagfa']
Items start with w from the said list:
[]
(ii) Write a Python program to convert a given list of tuples to a 8 CO2 K3
list of lists.
Original list of tuples: [(1, 2), (2, 3), (3, 4)]
Convert the said list of tuples to a list of lists: [[1, 2], [2, 3],
[3, 4]]
Original list of tuples: [(1, 2), (2, 3, 5), (3, 4), (2, 3, 4, 2)]
Convert the said list of tuples to a list of lists: [[1, 2],
[2, 3,5], [3, 4], [2, 3, 4, 2]]
(Or)
12 b) (i) Differentiate between append() and extend() methods in 8 CO2 K2
Python lists. Provide examples to illustrate their usage.
(ii) Write a Python function that takes a dictionary as input and 8 CO2 K3
returns the keys sorted in descending order based on their
associated values.

13 a) (i) Describe the structure of a Python package and explain how 8 CO3 K2
packages differ from modules.
(ii) Write a Python program that reads a date input from the 8 CO3 K3
user in the format "YYYY-MM-DD" and print in a user-friendly
format, such as "Monday, January 1, 2023".
(Or)
13 b) (i) Write a Python program that takes a text file as input and 8 CO3 K3
returns the number of words of a given text file.
Note: Some words can be separated by a comma with no
space.
(ii) Create a package structure named my_package that 8 CO3 K3
includes multiple modules (module1.py, module2.py, etc.).
Provide an example of how to import specific modules and
functions from within the my_package package.

Page 3 of 4
SECE/CoE/QPT/002/Rev. 00/03.05.2022
14 a) (i) Develop a class Animal with a method sound() that prints a 8 CO4 K3
generic sound. Then create two subclasses, Dog and Cat,
that override the sound() method to print specific sounds for
each animal. Demonstrate polymorphism by calling the
sound() method on instances of Dog and Cat.
(ii) Illustrate how to connect to a MongoDB instance for a 8 CO4 K2
sample application
(Or)
14 b) (i) Discuss the various methods available in MongoDB for 8 CO4 K2
retrieving documents from a collection. How do queries in
MongoDB differ from traditional SQL queries?
(ii) Create an event management application using MongoDB. 8 CO4 K3

15 a) (i) Write a Python script using NumPy to create an array of 20 8 CO5 K3


random integers between 1 and 100. Then, compute and
print the mean, median, and standard deviation of this array
using appropriate NumPy functions.
(ii) A DataFrame students contains columns 'StudentID', 'Name', 8 CO5 K3
'Maths', 'Science', and 'English'. Write a Python script to
normalize the scores in 'Maths', 'Science', and 'English'
columns so that each value is scaled between 0 and 1. Show
the DataFrame with normalized scores.
(Or)
15 b) (i) Describe and implement a Python function using NumPy that 8 CO5 K3
finds the indices of the minimum and maximum values in a
1D array. How can these indices be used in further data
analysis?
(ii) Create a Django view that interacts with an external API to 8 CO5 K3
fetch weather data based on user input (city name). Display
the weather information on the web page. Write the code for
the view and template.

Page 4 of 4
SECE/CoE/QPT/002/Rev. 00/03.05.2022

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy