0% found this document useful (0 votes)
4 views7 pages

Data Science and Python Concepts

The document consists of exam papers covering various topics in data science, including Big Data characteristics, data warehouses, data cleansing, and the use of NumPy and Pandas in data analysis. It includes practical Python code examples for data manipulation and analysis, as well as discussions on data science applications in fields like finance, healthcare, and supply chain optimization. Key concepts such as handling missing data, the differences between structured and unstructured data, and the data science process for tasks like fraud detection are also addressed.

Uploaded by

samarpanpanda71
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)
4 views7 pages

Data Science and Python Concepts

The document consists of exam papers covering various topics in data science, including Big Data characteristics, data warehouses, data cleansing, and the use of NumPy and Pandas in data analysis. It includes practical Python code examples for data manipulation and analysis, as well as discussions on data science applications in fields like finance, healthcare, and supply chain optimization. Key concepts such as handling missing data, the differences between structured and unstructured data, and the data science process for tasks like fraud detection are also addressed.

Uploaded by

samarpanpanda71
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

Exam Paper 1 (Image: image_26fda3.

jpg)
PART - A
1. List the three V's that characterize Big Data with suitable examples.
●​ Volume: The sheer amount of data (e.g., Terabytes of social media posts generated daily).
●​ Velocity: The speed at which data is generated and processed (e.g., Real-time stock
market trading ticks).
●​ Variety: The different types of data formats (e.g., Structured SQL data, unstructured text
emails, and video files).

2. Explain the purpose of a data warehouse with a suitable example.


A data warehouse acts as a centralized repository designed to store large volumes of historical
data from multiple sources. It is optimized for query and analysis rather than transaction
processing.
●​ Example: A retail chain combining sales data from its Point of Sale (POS) systems,
inventory data, and HR records into one warehouse to analyze seasonal sales trends over
the past five years.​
3. What is data cleansing?​
Data cleansing (or data cleaning) is the process of identifying and correcting (or removing)
corrupt, inaccurate, incomplete, or irrelevant records from a dataset to improve data
quality.

4. Bring out the difference between structured and unstructured data.


●​ Structured Data: Highly organized and easily searchable, typically stored in tabular
formats like relational databases (e.g., an Excel sheet with names, ages, and salaries).
●​ Unstructured Data: Lacks a pre-defined data model or organization, making it harder to
process (e.g., text-heavy emails, social media comments, audio, and video files).

5. Define dummy variable. Why they are used in data transformation?

A dummy variable is a numerical variable used to represent categorical (qualitative) data,


typically taking values of 0 or 1. They are used in data transformation because most machine
learning algorithms require numerical input; dummy variables allow us to include categories
(like "Color: Red, Blue, Green") in mathematical models.

PART - B
6. Describe the process of handling missing data.
Handling missing data generally involves three steps:
1.​ Identification: Detecting where data is missing (e.g., using [Link]().sum() in Pandas).
2.​ Assessment: Understanding why it's missing (is it random, or is there a pattern?).
3.​ Treatment: * Deletion: Dropping rows or columns if the missing data is minimal and
random.
○​ Imputation: Filling in missing values using statistical measures (mean, median, mode),
or using predictive machine learning models to estimate the missing values.

7. Write a Python code using NumPy to reshape a 1D array of 12 even consecutive


numbers into a 3x4 2D array.

Python

import numpy as np​


# Create 1D array of 12 consecutive even numbers starting from 2​
arr_1d = [Link](2, 26, 2)​
# Reshape to 3x4​
arr_2d = arr_1d.reshape(3, 4)​
print(arr_2d)​

8. (A) Find the outcome for the following code snippet


●​ print([Link](3,5,0)): Creates a 3x5 matrix with 1s on the main diagonal and 0s elsewhere.
●​ print([Link](3,5,1)): Creates a 3x5 matrix with 1s on the upper diagonal (shifted right by 1).
●​ print([Link](3,5,-2)): Creates a 3x5 matrix with 1s on the lower diagonal (shifted down by
2).
●​ print([Link](3)): Creates a standard 3x3 square identity matrix (1s on the main
diagonal).

(B) What is a DataFrame? (in Panda).

A DataFrame is a 2-dimensional, mutable, tabular data structure in Pandas with labeled axes
(rows and columns). It can hold data of different types (integers, floats, strings) in its columns.

Exam Paper 2 (Image: image_26fe00.jpg)


PART - A

1. Define the facets of data.

Facets of data refer to the different characteristics and forms that data can take in an
ecosystem. Common facets include structured data, unstructured data, semi-structured data,
natural language, machine-generated data, graph-based data, and audio/video data.

2. What are redundant whitespaces? Give the python function to identify.

Redundant whitespaces are extra spaces before, after, or between text characters that provide
no meaningful information. In Python, you can remove them using the string functions .strip()
(both ends), .lstrip() (left end), and .rstrip() (right end).

3. Write the numpy array function for 1D array and 2D array data of 6 elements.

Python

import numpy as np​


arr_1d = [Link]([1, 2, 3, 4, 5, 6])​
arr_2d = [Link]([[1, 2, 3], [4, 5, 6]])​

4. Define Pandas Series.

A Pandas Series is a one-dimensional labeled array capable of holding data of any type (integer,
string, float, python objects, etc.). The axis labels are collectively called the index.

5. What is the primary purpose of NumPy in data science?

The primary purpose of NumPy is to provide highly efficient, vectorized mathematical and
logical operations on large multi-dimensional arrays and matrices, serving as the foundational
building block for scientific computing in Python.

PART - B
6. Describe the basic operations in NumPy Arrays... joining, splitting, searching, sorting...
●​ Joining: Combining arrays (e.g., [Link]((arr1, arr2))).
●​ Splitting: Breaking an array into multiple smaller arrays (e.g., np.array_split(arr, 3)).
●​ Searching: Finding indices of specific elements based on conditions (e.g., [Link](arr ==
4)).
●​ Sorting: Arranging elements in ascending or descending order (e.g., [Link](arr)).

7. Explain the datascience process and its key steps for credit card fraud detection.
1.​ Data Collection: Gathering historical credit card transaction logs.
2.​ Data Cleaning: Handling missing values and standardizing formats.
3.​ EDA: Analyzing patterns (e.g., transaction frequencies, typical locations).
4.​ Feature Engineering: Creating variables like "distance from last transaction."
5.​ Modeling: Training anomaly detection algorithms (like Isolation Forests or Logistic
Regression) to classify transactions as legitimate or fraudulent.
6.​ Deployment: Integrating the model into the payment gateway to flag real-time
transactions.

8. Discuss about data warehouse and data mart with necessary examples.
●​ Data Warehouse: An enterprise-wide repository of data from various sources (e.g., A
global bank's central database holding HR, customer accounts, and loan data).
●​ Data Mart: A specialized subset of a data warehouse focused on a single business line or
department (e.g., A specific database extracted from the bank's warehouse only
containing loan data for the risk assessment team).

Exam Paper 3 (Image: image_26fe57.jpg)


PART - A

1. What advantages does NumPy offer over Python lists?

NumPy arrays use contiguous memory blocks, making them significantly faster and more
memory-efficient. They also support direct, element-wise mathematical operations
(vectorization) without needing for loops.

2. NumPy in financial/stock market analysis:

Used for high-speed mathematical calculations on large datasets, such as computing moving
averages, daily returns, and complex matrix multiplications for portfolio risk optimization.

3. Data Science in supply chain optimization:

Helps predict demand fluctuations, optimize delivery routes to save fuel, and manage inventory
levels to prevent overstocking or stockouts.

4. Difference between .loc[] and .iloc[]:


●​ .loc[] accesses rows/columns by their labels (names).
●​ .iloc[] accesses rows/columns by their integer positions (indexes starting from 0).

5. Pandas in time-series analysis:

Provides powerful DatetimeIndex capabilities, allowing easy resampling (e.g., daily to monthly),
shifting data, calculating rolling windows (like 30-day moving averages), and handling timezone
conversions.

PART - B
6. NumPy in real-time signal processing:

Python

import numpy as np​


# Generating a sine wave (e.g., audio signal representation)​
time = [Link](0, 10, 0.1)​
amplitude = [Link](time)​

7 & 8. Data Science in automotive (Autonomous vehicles):

Data science processes massive amounts of sensor data (LIDAR, cameras) to train computer
vision models for obstacle detection.

Filtering GPS using Pandas:

Python

import pandas as pd​


# Assuming df has real-time GPS speed data​
speeding_vehicles = df[df['Speed_kmh'] > 100]​

9. Data Science for fake news detection:

Uses Natural Language Processing (NLP) to analyze text sentiment and linguistic patterns.

Filtering using Pandas:

Python

reliable_news = df[df['Credibility_Score'] >= 0.75]​


Exam Paper 4 (Image: image_26fe98.jpg)
PART - A

1. Data Science in fraud detection:

It relies on machine learning models to recognize patterns of normal behavior and instantly flag
anomalies (like a credit card suddenly being used in two different countries within an hour).

2. NumPy in real-world image processing:

Images are essentially 2D or 3D matrices of pixel values. NumPy allows for fast matrix
operations required for image filtering, rotation, cropping, and color-channel manipulation.

3. Pandas in healthcare analytics:

Used to clean and organize messy electronic health records (EHR), merge patient history
tables, and calculate summary statistics for clinical trial outcomes.

4. Data Science in supply chain optimization: (Duplicate from Paper 3)

Demand forecasting, route optimization, and predictive maintenance for delivery fleets.

5. Pandas in weather forecasting:

Helps wrangle massive time-series datasets from meteorological sensors, fill in missing sensor
gaps (fillna()), and compute daily/monthly weather averages.

PART - B

6. Financial risk management & computing returns:

Python

import numpy as np​


prices = [Link]([100, 102, 101, 105])​
# Calculate percentage returns​
returns = [Link](prices) / prices[:-1] * 100 ​

7. Personalization in e-commerce:

Data science powers recommendation engines (like "Customers who bought this also bought").
Analyzing purchase trends:

Python

# Summing sales by product category​


category_sales = [Link]('Category')['Sales'].sum()​

8. Sports analytics:

Used to evaluate player performance metrics and optimize game strategy.

Computing batting averages:

Python

df['Batting_Average'] = df['Total_Runs'] / df['Total_Outs']​

9. Climate modeling & rainfall patterns:

Python

# Analyzing monthly rainfall averages​


monthly_rainfall = [Link]('Month')['Rainfall_mm'].mean()​

Would you like me to elaborate on any of these Python snippets or data science concepts?

You might also like