Reg.
QP CODE: (23AD404) No.
SRI KRISHNACOLLEGE OF TECHNOLOGY
An Autonomous Institution,Approved by AICTE and afftiated to Anna University
Accredited by NAAC with "A* grade
SRI KRISHN A Coimbatore, Tamil Nadu
NSTTUTONS
Continuous Internal Examination-!
Programme(s) Semester Course Code(s) Course Title
[Link] -
4 23AD404 PYTHON FORDATA SCIENCE
AI& DS
Time: 1.5 Hours Max Marks: 50
Date: 29.01.2025 No. of Pages:02
COURSE OUTCOMES:
CO1Recognizethe general principles and good algorithmicproblem solving. U
CO2 Interpret the fundamental Python syntax and semantics and use of Python control
flow statements.
CO3 Understand variables, data types, control flow structures such as loops and
condiionals), functions, and file handling.
CO4 Design and implement modular and reusable code AP
CO5 Examining compounddata using Python lists, tuples and dictionaries. AP
CO6Develop proficiency in fundamental data science techniques, including data loading, AP
cleaning, preprocessing, and visualization.
PART -A (9X2= 18MARKS) RBT CO Marks
1. Infer "Towers of Hanoi" problem briefly. U CO1 2
2.|Distinguish between Python's interactive mode and CO1 2
Script mode.
3.|List the primary data types in Python with an CO2 2
example.
4. Illustrate the role of control flow in an algorithm U CO2 2
with an example.
5. Apply operator precedence to evaluate the AP CO2 2
expression 3+5 * 2.
6. Demonstrate the swapping of two variables in AP CO3 2
Python.
7. Criticize the pseudocode provided below for AP CO3 2
finding the minimum in alist:
Min = List[0]
for i in List:
ifi>Min:
Min =i
8. Differentiate between parameters and arguments in CO3 2
afunction.
9. Indicate the importance of comments in Python CO3 2
programs.
1
RBT/COy
PART - B (2 X16 =32 MARKS) MARKS
RBT: AP
10.i) Apply your knowledge of functions to write a Python CO:CO1
program that calculates the distance between two points in Marks: 8
a2D space. Provide thestep-by-step logic and output. RBT: AP
i) Evaluate the computational efficiency of using recursion CO:CO1
versus iteration for solving algorithmic problems. Use the Marks: 8
"Guess an Integer Number in a Range" problem as a case
study.
(OR) RBT: AP
11. i) Explain the purpose of loop structure in a programming CO:CO1
language. Describe the syntax and semantics of any two Marks: 8
loop structures provided by Python.
RBT: AP
ii) Demonstrate how to solve the Towers of Hanoi problem CO:CO2
using recursion in Python. Include code, flowof execution, Marks: 8
and explain the logic in detail.
12. i) Describe the use of Python's data types (int, float, boolean, RBT: AP
CO:CO3
string, and list) with examples. Discuss their roles in Marks: 8
building efficient algorithms.
n) Explain the difference between iteration and recursion with RBT: AP
CO:CO3
examples. Ilustrate their advantages and limitations in Marks: 8
algorithm design.
(OR)
13. i) Assess the performance of tuple assignments in Python by CO:CO3
RBT: AP
comparing it to traditional variable assignment approaches. Marks: 8
Provide examples and scenarios.
Illustrate the steps to insert a card into a sorted list using RBT: AP
CO:CO3
pseudocode and flowchart. Marks: 8
I/END)/
2
Reg.
QP CODE: (23AD404) No
SRI KRISHNA COLLEGE OF TECHNOLOGY
An Autonomous Institution, Approved by AICTE and affiated to Anna University
Accredited by NAAC with "A' grade
SRiKR:SHNA
INS! Coimbatore, Tamil Nadu
30ONS
Continuous Internal Examination - ll
Programnme(s) Semester Course Code(s) Course Title
B.E AI&ML 4 23AD404 PYTHON FOR DATA SCIENCE
Time: 1.5 Hours Max Marks: 50
Date: 03.03.2025 No. of Pages:02
COURSE OUTCOMES:
U
CO1Recognize the general principles and good algorithmic problemsolving.
CO2| Interpret the fundamental Python syntax and semantics and use of Python U
control flow statements.
CO3 Understand variables, data types, control flow structures such as loops and
conditionals), functions, and file handling AP
CO4 Design and implement modular and reusable code
AP
COS Examining compound data using Python lists, tuples and dictionaries. AP
CO6 Develop proficiency in fundamental data science techniques, including data
ioading, cleaning, preprocessing, and vistualization.
RBT CO Marks
PART - A (9X 2 = 18 MARKS)
Give the difference between if and if-else U CO3 2
1.
statements.
CO3 2
2. Infer the purpose of the break statement in loops? 2
U CO3
3. Give an example of string immutability in Python. CO4 2
AP
4. Enumerate the concept of aliasing in lists with an
example. AP CO4 2
5. Examine different dictionary operations and their
real-time applications. AP CO5 2
6. Predict the output of the following code:
x= [1, 2, 3]
y=x
[Link](4)
print(&) AP CO5 2
7. Identify and fix the error in the following code:
def greet):
print("Hello")
greet)
return CO5 2
AP
8 ldentify the mistake in the following list operation
and fix it:
Ist =[1, 2, 3]
lst = Ist+4
print(st) AP CO5
|9. List any four dictionary methods used in Python.
PART - B (2 X16 = 32 MARKS) RBT/CO/
MARKS
10. i) Create a menu-driven Python program to perform CRUD RBT: AP
(Create, Rcad, Update, Delete) operations on adictionary CO:CO4
Marks: 8
where keysare student names and values are their mnarks.
)Develop a Python program to find the Greatest Common RBT: AP
Divisor (GCD) of two numbers using both recursion and CO:CO3
Marks: 8
iteration. Explain the efficiency of both approaches.
(OR)
11. 1) |Create a Python program to simulate a basic banking kB:AP
system where users can deposit, withdraw, and check their CO:CO4
balance using functions. Marks: 8
Develop a programn to simulate a simple login system using RBT: AP
a dictionary. The program should allow a user to CO:CO5
login, and change their password using conditionalregister,
(if-elif
Marks: 8
else) statements.
12.|i) Implement a Python function to compute the
square
a given number using the Newton-Raphson method. root of
RBT: AP
CO:CO3
Compare it with Python's built-in [Link](). Marks: 8
iü) Develop a Python program that defines a function to RBT: AP
generate Pascal's Triangle up to a given number of rows. CO:C03
Use nested loops and function calls for implementation. Marks: 8
(OR)
13. i)|Develop a Python program that reads a string from the RBT: AP
user
and performs the following operations: CO:CO4
Count the number of vowels and consonants. Marks: 8
Convert all vowels to uppercase.
" Reverse the string without using built-in functions.
|ii) Develop a Python program that takes alist of tuples (each RBT: AP
containing a student's name and marks) and sorts them in CO:CO5
Marks: 8
descending order based on marks. If marks are the same,
sort alphabetically by name.
/ENDI)
QP CODE: (23AD404) Reg.
No. h27 23TUAMo6o
SRI KRISHNACOLLEGE OF TECHNOLOGY
An Autonomous Institution, Approved by AICTE and affiliated to Anna University
SRI KRISHNA Accredited by NAAC with "A" grade
INSTITUTIONS Coimbatore, Tamil Nadu
Continuous Internal Assessment -lI
Programme(s) Semester Course Code(s) Course Title
[Link]-AI&ML 4 23AD404 PYTHON FOR DATASCIENCE
Time: 1.5 Hours Max Marks: 50
Date:25.03.2025 No. of Pages:02
COURSE OUTCOMES:
U
CO1 Recognize the general principles and good algorithmic problem solving
CO2| Interpret the fundamental Python syntax and semantics and use of Python control U
flow statements
CO3 Understand variables, data types, control flow structures such as loops and U
conditionals), functions, and file handling
AP
CO4 Design and implement modular and reusable code
AP
CO5Examining compound data using Python lists, tuples and dictionaries AP
CO6 Develop proficiency infundamental data sciencetechniques, including data loading,
cleaning, preprocessing, and visualization.
RBT CO Marks
PART - A (9 X 2 = 18 MARKS)
U CO4 2
1. Describe the role of NumPy in data analysis.
U CO4 2
2. Compare and contrast between Pandas Series and
DataFrame.
CO4
3. Differentiate between Matplotlib and Seaborn.
CO5 2
4. Infer the importance of data cleaning in Data Science.
AP CO5
5. Write a NumPy program to create an array of 10
zeros.
AP CO5
6. Write a python program to load a CSV file named
'data. csv' into a DataFrame using Pandas,
AP CO6 2
7. Write apython program to plot a simple line graph
for the data x=[1, 2,3, 4]and y=[10, 20, 25, 30] using
Matplotlib 2
AP CO6
8. Using Seaborn, load the tips' dataset and display
the first five rows.
AP CO6 2
9. Create a Pandas DataFrame from a NumPy array
containing numbers from 1 to10.
PART - B (2X 16 = 32 MARKS) RBT/CO/
MARKS
RBT: U
10. i) Suppose you are working on an e-commerce dataset with CO:CO4
customer purchase behavior. How would you creatively use Marks: 8
Pandas to segmernt customers, analyze trends over timne, and
create personalized marketing strategies? What unique
insights could you derive from such analysis.
1
10. ii) Using Pandas, read a CSV file named '[Link]', which RBT: AP
CO:CO4
contains columns 'Name', 'Age', and 'Grade'. Calculate the Marks: 8
average age and display the names of students who scored
above 85.
(OR)
11.i) |In the process of data preprocessing, how do you determine RBT: U
CO:CO5
whether imputing missing values Or removing Marks: 8
rows/columns with missing values is the best approach?
What factors do you need to analyze before making this
decision.
ii)|You generate a 3x3 matrix with values from 2to 10using RBT: AP
CO:COS
NumPy. After performing aseries of matrix operations (such Marks: 8
as addition or multiplication), how would you assess
whether the generated matrix meets the expected properties
(e.g.,non-negative values,correct size, etc.)? What methods
would yoü use to validate the result.
12. i) Using Pandas, read a CSV file named '[Link]' RBT: AP
CO:CO5
containing columns 'EmployeelD', Name', 'Department', Marks: 8
and 'Salary'. Group the data by 'Department' and calculate
the average salary for each department.
RBT: AP
i) Suppose you want to create a 5x5 matrix where the diagonal
CO:CO6
elements are filled with random numbers between 1 and 10. Marks:
How would you modify the program to replace the diagonal
with random values instead of a fixed range from 1to 5?
What. would be the impact of randomizing the diagonal
elements.
(OR)
RBT: AP
13.i) Imagine you want to enhance the box plot with additional CO:CO6
information such as the nean or nedian values of scores for Marks: 8
better comparison. How would you modify the Seaborn box
plot to include these values? What additional insights would
thís provide for interpreting the distribution of scores.
RBT: AP
iü) Load a dataset containing daily temperatures for a month CO:CO6
using Pandas, Calculate the moving average using Num>y Marks: 8
and plot both the daily temperatures and the moving
average using Matplotlib.
/END)/