0% found this document useful (0 votes)
236 views6 pages

Python for Data Science Exam Paper

The document outlines the Continuous Internal Examination for the course 'Python for Data Science' at Sri Krishna College of Technology. It includes course outcomes, examination structure, and a variety of questions assessing knowledge in Python programming, data structures, and data science techniques. The exam is structured into two parts, with Part A consisting of short answer questions and Part B containing more detailed programming tasks.

Uploaded by

hykgamers
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

Topics covered

  • Moving average,
  • Variable assignment,
  • Python syntax,
  • Pandas,
  • Data analysis,
  • DataFrame,
  • Tuple assignments,
  • Matplotlib,
  • Data preprocessing,
  • Towers of Hanoi
0% found this document useful (0 votes)
236 views6 pages

Python for Data Science Exam Paper

The document outlines the Continuous Internal Examination for the course 'Python for Data Science' at Sri Krishna College of Technology. It includes course outcomes, examination structure, and a variety of questions assessing knowledge in Python programming, data structures, and data science techniques. The exam is structured into two parts, with Part A consisting of short answer questions and Part B containing more detailed programming tasks.

Uploaded by

hykgamers
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

Topics covered

  • Moving average,
  • Variable assignment,
  • Python syntax,
  • Pandas,
  • Data analysis,
  • DataFrame,
  • Tuple assignments,
  • Matplotlib,
  • Data preprocessing,
  • Towers of Hanoi

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)/

Common questions

Powered by AI

Data cleaning is pivotal in data science as it ensures the accuracy and consistency of data for analysis. Effective strategies for handling dirty data include removing or imputing missing values, correcting inconsistencies, filtering out irrelevant data, and removing duplicates. These processes help in improving data quality, leading to better model performance and more reliable insights. Clean data minimizes noise and errors, thereby increasing the robustness of data analysis .

Data visualization plays a critical role in data science by allowing researchers to graphically represent complex datasets, making it easier to identify patterns, trends, and anomalies. Libraries like Matplotlib and Seaborn provide tools to create a wide array of static, animated, and interactive plots. Matplotlib offers detailed, customizable figures, whereas Seaborn builds on it to provide statistical data visualization with less coding. These visual representations aid in better analysis and decision-making processes .

Tuple assignment in Python allows simultaneous assignment of multiple variables, which is more concise and can enhance readability. Unlike traditional assignments that might require multiple lines, a tuple assignment can achieve the same in one line. This can lead to performance gains by reducing the overhead of accessing memory locations multiple times. Additionally, it allows for swapping variable values without a temporary holding variable, thus making code cleaner and potentially faster under certain circumstances .

Aliasing in Python occurs when two or more list variable names point to the same data object. This leads to potential pitfalls where changes in one alias affect all others referencing the same data. For example, if 'a = [1, 2, 3]' and 'b = a', both 'a' and 'b' refer to the same list object. Modifying 'b.append(4)' will also modify 'a', which may lead to unintended side effects if not carefully managed .

The computational efficiency of recursion can be lower compared to iteration due to the overhead of multiple function calls and stack memory consumption. In the 'Guess an Integer Number in a Range' problem, recursion may lead to deeper call stacks if not implemented with tail-call optimization, while iteration can handle large ranges more efficiently with constant stack size. Recursion provides elegance and simplicity but often at the cost of performance, while iteration might require more complex logic but can optimize run-time performance .

Python's data preprocessing capabilities are crucial, as missing values can lead to biased or inaccurate analyses. The method of handling missing values, such as imputation or omission, affects the dataset's integrity and hence the analysis results. Imputing maintains data size and introduces estimated values, whereas removing can simplify models at the risk of losing pertinent information. Choosing the right approach depends on the data pattern and analysis goals .

Joint visualization using Seaborn offers a simultaneous view of distribution and relationships within data, such as those between two variables. For instance, a joint plot combines scatter plots with histograms or kernel density estimation, providing insights into correlation patterns, data distribution, and potential outliers. Such comprehensive visualization aids in understanding complex interactions in the dataset that might not be apparent in isolated visualizations, supporting deeper insights into underlying data structures and dependencies .

Recursion is a method of solving problems where the function calls itself, whereas iteration involves using loops to repeat a set of instructions. Recursion can simplify the code for problems like the Towers of Hanoi or tree traversals but can lead to excessive memory usage if not managed well due to stack overflow. Iteration generally uses less memory and is more efficient for large input sizes as it does not involve multiple function calls. However, some algorithms, naturally recursive in nature, might become complex and harder to understand when transformed into iterative forms .

Modular and reusable code in Python can be achieved by organizing the code into functions and classes. This approach promotes reusable code, reduces redundancy, and makes maintenance easier. Modular code allows developers to isolate different functionalities into separate parts, enhancing clarity and aiding collaborative development. Each module can be debugged individually and reused across different projects, which saves time in long-term development cycles .

Control flow statements like if-else, for, and while loops allow algorithms to make decisions and execute instructions conditionally or repetitively, thus enhancing program efficiency and decision-making capability. For example, using a for loop with an if condition to iterate through a list and perform operations only on specific elements demonstrates control flow’s role in efficiently organizing complex data handling tasks .

You might also like