1
Arulmigu Meenakshi Amman college of Engineering
Vadamavandal-604410.
Prepared by,
V.Umapathy,
Prof./Mech.
Imortant Questions and Answers
IT25201-Foundations of Data Science using Python.
Syllabus
1. Python Language Basics and Data Structures: Python Language Basics - Scalar Types -
Control Flow. Data Structures and Sequences: Tuple - List - Built-in Sequence Functions -
dict - set- List, Set, and Dict Comprehensions. Functions: Namespaces, Scope, and Local
Functions - Returning Multiple Values - Functions Are Objects - Files and the Operating
System.
Practical:
1. Programs using Data Frames
2. Programs using functions and files
2. Numpy Basics: The NumPy ndarray: A Multidimensional Array Object - Universal
Functions: Fast Element-Wise Array Functions - Array-Oriented Programming with Arrays -
File Input and Output with Arrays - Linear Algebra - Pseudorandom Number Generation.
Practical:
1. Programs using numpy
2. Programs to solve linear algebra problems with numpy functions
3. Pandas Basics: Introduction to pandas Data Structures –Loading and Understanding Data-
Data aggregation for computing Descriptive Statistics- Data Cleaning and Preprocessing
Practical:
1. Programs using numpy
2. Solving linear algebra problems
h.
4. Data Loading, Storage, and File Formats: Reading and Writing Data in Text Format -
ec
./M
Binary Data Formats - Interacting with Web APIs - Interacting with Databases
Practical:
of
Pr
1. Data and Databases
2. Web APIs
y,
h
at
ap
m
U
V.
, 2
5. Data Exploration: Data Transformation - String Manipulation. Data Wrangling:
Hierarchical Indexing - Combining and Merging Datasets - Reshaping and Pivoting.
Practical:
1. String manipulations
2. Data wrangling
6. Data Wrangling: Data Aggregation and Group Operations: GroupBy Mechanics - Data
Aggregation - Apply: General split-apply-combine - Pivot Tables and Cross-Tabulation -
Date and Time Data Types.
Practical:
1. Data aggregation operations
2. Handle time series data
7. Data Visualization: Introduction to Data Visualization- Visualizing categorical data,
visualizing time series data, Visualizing multiple variables -Visualizing Distribution
&Relationships -Multivariate and Time Series Visualization
exploration
Practical:
1. Visualization of Different kinds of Data
2. Distribution Analysis
S.No. Description
Unit-I
Python Language Basics and Data Structures
Prepared by,
V.Umapathy,Prof./Mech.
Basic Concepts
Topic Basic Concepts / Key Points
Python Language Python is a high-level, interpreted, object-oriented and dynamically typed
Basics language. Uses indentation to define code blocks.
Scalar Types Basic single-value data types: int, float, complex, bool, str and None.
Control Flow Controls program execution using if, elif, else, for, while, break, continue and pass.
Ordered and immutable collection. Written using (). Example: t = (10, 20, 30). Supports
Tuple
indexing and slicing.
Ordered and mutable collection. Written using []. Supports adding, deleting and modifying
List
elements. Example: L=[1,2,3].
.
Built-in Sequence Common functions: len(), min(), max(), sum(), sorted(), reversed(),
h
ec
Functions enumerate() and zip().
./M
Dictionary Mutable collection of key–value pairs. Written using {}. Example: d={'a':10,'b':20}.
of
(dict) Keys must be unique.
Pr
Set Unordered collection of unique elements. Written using {} or set(). Supports union, intersection
hy,
at
ap
m
U
V.
, 3
and difference.
List Comprehension Short method to create lists. Example: [x*x for x in range(5)].
Set Comprehension Creates sets using a compact expression. Example: {x*x for x in range(5)}.
Dict Comprehension Creates dictionaries compactly. Example: {x:x*x for x in range(5)}.
A namespace is a mapping between names and objects. Examples: local, global and
Namespaces
built-in namespaces.
Defines where a variable can be accessed. Main scopes are Local, Enclosing, Global and
Scope
Built-in (LEGB).
Local A function defined inside another function. It can access variables from its enclosing
Functions function.
Returning Multiple Python functions can return multiple values as a tuple. Example: return a,
Values b, c.
Functions Are Functions can be assigned to variables, passed as arguments and returned from
Objects other functions.
Files are handled using open(). Common modes: r–read, w–write, a–append. Methods include
Files
read(), write() and close().
Operating Python's os module provides functions for files, directories and system operations,
System such as os.getcwd(), os.listdir() and os.mkdir().
Important Python data structures are used to store and organize data efficiently, while functions
Concept provide code reuse, modularity and readability.
Multiple Choice QA
Prepared by,
V.Umapathy,Prof./Mech.
1. Which of the following is an immutable data structure in Python?
A) List
B) Dictionary
C) Tuple
D) Set
Answer: C) Tuple
Reason: A tuple is immutable, meaning its elements cannot be changed after creation. Lists,
dictionaries, and sets are mutable.
h.
ec
./M
2. Which Python statement is used to create a dictionary?
of
A) d = [1, 2, 3]
Pr
B) d = {1, 2, 3}
hy,
at
ap
m
U
V.
, 4
C) d = {"name": "Ravi", "age": 20}
D) d = (1, 2, 3)
Answer: C) d = {"name": "Ravi", "age": 20}
Reason: A dictionary stores data as key-value pairs. Curly braces {} with key: value pairs are used
to create a dictionary.
3. What will be the output of the following code?
x = [10, 20, 30, 40]
print(x[1:3])
A) [10, 20]
B) [20, 30]
C) [20, 30, 40]
D) [10, 20, 30]
Answer: B) [20, 30]
Reason: Python slicing follows the form start:stop, where the stop index is excluded. Therefore,
indices 1 and 2 are selected.
4. What is the purpose of a list comprehension in Python?
A) To define a class
B) To create a list concisely using an expression
C) To open a file
D) To define a namespace
Answer: B) To create a list concisely using an expression
Reason: List comprehension provides a compact way to create lists. For example:
squares = [x*x for x in range(5)]
h .
ec
It produces [0, 1, 4, 9, 16].
./M
of
5. What will a Python function return when it contains return a, b?
Pr
y,
A) Only a
h
at
ap
m
U
V.
Arulmigu Meenakshi Amman college of Engineering
Vadamavandal-604410.
Prepared by,
V.Umapathy,
Prof./Mech.
Imortant Questions and Answers
IT25201-Foundations of Data Science using Python.
Syllabus
1. Python Language Basics and Data Structures: Python Language Basics - Scalar Types -
Control Flow. Data Structures and Sequences: Tuple - List - Built-in Sequence Functions -
dict - set- List, Set, and Dict Comprehensions. Functions: Namespaces, Scope, and Local
Functions - Returning Multiple Values - Functions Are Objects - Files and the Operating
System.
Practical:
1. Programs using Data Frames
2. Programs using functions and files
2. Numpy Basics: The NumPy ndarray: A Multidimensional Array Object - Universal
Functions: Fast Element-Wise Array Functions - Array-Oriented Programming with Arrays -
File Input and Output with Arrays - Linear Algebra - Pseudorandom Number Generation.
Practical:
1. Programs using numpy
2. Programs to solve linear algebra problems with numpy functions
3. Pandas Basics: Introduction to pandas Data Structures –Loading and Understanding Data-
Data aggregation for computing Descriptive Statistics- Data Cleaning and Preprocessing
Practical:
1. Programs using numpy
2. Solving linear algebra problems
h.
4. Data Loading, Storage, and File Formats: Reading and Writing Data in Text Format -
ec
./M
Binary Data Formats - Interacting with Web APIs - Interacting with Databases
Practical:
of
Pr
1. Data and Databases
2. Web APIs
y,
h
at
ap
m
U
V.
, 2
5. Data Exploration: Data Transformation - String Manipulation. Data Wrangling:
Hierarchical Indexing - Combining and Merging Datasets - Reshaping and Pivoting.
Practical:
1. String manipulations
2. Data wrangling
6. Data Wrangling: Data Aggregation and Group Operations: GroupBy Mechanics - Data
Aggregation - Apply: General split-apply-combine - Pivot Tables and Cross-Tabulation -
Date and Time Data Types.
Practical:
1. Data aggregation operations
2. Handle time series data
7. Data Visualization: Introduction to Data Visualization- Visualizing categorical data,
visualizing time series data, Visualizing multiple variables -Visualizing Distribution
&Relationships -Multivariate and Time Series Visualization
exploration
Practical:
1. Visualization of Different kinds of Data
2. Distribution Analysis
S.No. Description
Unit-I
Python Language Basics and Data Structures
Prepared by,
V.Umapathy,Prof./Mech.
Basic Concepts
Topic Basic Concepts / Key Points
Python Language Python is a high-level, interpreted, object-oriented and dynamically typed
Basics language. Uses indentation to define code blocks.
Scalar Types Basic single-value data types: int, float, complex, bool, str and None.
Control Flow Controls program execution using if, elif, else, for, while, break, continue and pass.
Ordered and immutable collection. Written using (). Example: t = (10, 20, 30). Supports
Tuple
indexing and slicing.
Ordered and mutable collection. Written using []. Supports adding, deleting and modifying
List
elements. Example: L=[1,2,3].
.
Built-in Sequence Common functions: len(), min(), max(), sum(), sorted(), reversed(),
h
ec
Functions enumerate() and zip().
./M
Dictionary Mutable collection of key–value pairs. Written using {}. Example: d={'a':10,'b':20}.
of
(dict) Keys must be unique.
Pr
Set Unordered collection of unique elements. Written using {} or set(). Supports union, intersection
hy,
at
ap
m
U
V.
, 3
and difference.
List Comprehension Short method to create lists. Example: [x*x for x in range(5)].
Set Comprehension Creates sets using a compact expression. Example: {x*x for x in range(5)}.
Dict Comprehension Creates dictionaries compactly. Example: {x:x*x for x in range(5)}.
A namespace is a mapping between names and objects. Examples: local, global and
Namespaces
built-in namespaces.
Defines where a variable can be accessed. Main scopes are Local, Enclosing, Global and
Scope
Built-in (LEGB).
Local A function defined inside another function. It can access variables from its enclosing
Functions function.
Returning Multiple Python functions can return multiple values as a tuple. Example: return a,
Values b, c.
Functions Are Functions can be assigned to variables, passed as arguments and returned from
Objects other functions.
Files are handled using open(). Common modes: r–read, w–write, a–append. Methods include
Files
read(), write() and close().
Operating Python's os module provides functions for files, directories and system operations,
System such as os.getcwd(), os.listdir() and os.mkdir().
Important Python data structures are used to store and organize data efficiently, while functions
Concept provide code reuse, modularity and readability.
Multiple Choice QA
Prepared by,
V.Umapathy,Prof./Mech.
1. Which of the following is an immutable data structure in Python?
A) List
B) Dictionary
C) Tuple
D) Set
Answer: C) Tuple
Reason: A tuple is immutable, meaning its elements cannot be changed after creation. Lists,
dictionaries, and sets are mutable.
h.
ec
./M
2. Which Python statement is used to create a dictionary?
of
A) d = [1, 2, 3]
Pr
B) d = {1, 2, 3}
hy,
at
ap
m
U
V.
, 4
C) d = {"name": "Ravi", "age": 20}
D) d = (1, 2, 3)
Answer: C) d = {"name": "Ravi", "age": 20}
Reason: A dictionary stores data as key-value pairs. Curly braces {} with key: value pairs are used
to create a dictionary.
3. What will be the output of the following code?
x = [10, 20, 30, 40]
print(x[1:3])
A) [10, 20]
B) [20, 30]
C) [20, 30, 40]
D) [10, 20, 30]
Answer: B) [20, 30]
Reason: Python slicing follows the form start:stop, where the stop index is excluded. Therefore,
indices 1 and 2 are selected.
4. What is the purpose of a list comprehension in Python?
A) To define a class
B) To create a list concisely using an expression
C) To open a file
D) To define a namespace
Answer: B) To create a list concisely using an expression
Reason: List comprehension provides a compact way to create lists. For example:
squares = [x*x for x in range(5)]
h .
ec
It produces [0, 1, 4, 9, 16].
./M
of
5. What will a Python function return when it contains return a, b?
Pr
y,
A) Only a
h
at
ap
m
U
V.