0% found this document useful (0 votes)
3 views3 pages

Answer For IAT 2 FDS Using Python

The document contains answers to a series of questions related to Python programming, including definitions of scalar types, control flow statements, tuples, and the differences between lists and tuples. It also covers concepts such as list comprehension, NumPy, DataFrames in Pandas, GroupBy operations, data cleaning techniques, and the purpose of data visualization. Each answer provides essential information and examples to illustrate the concepts.

Uploaded by

Abitha G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Answer For IAT 2 FDS Using Python

The document contains answers to a series of questions related to Python programming, including definitions of scalar types, control flow statements, tuples, and the differences between lists and tuples. It also covers concepts such as list comprehension, NumPy, DataFrames in Pandas, GroupBy operations, data cleaning techniques, and the purpose of data visualization. Each answer provides essential information and examples to illustrate the concepts.

Uploaded by

Abitha G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Part A

1. Answer: B
2. Answer: C
3. Answer: C
4. Answer: B
5. Answer: C
6. Answer: B
7. Answer: B

8. Answer: C
9. Answer: C
10. Answer: B

Part B
1. Define scalar types in Python. Give examples.

Answer:
Scalar types are basic data types that represent a single value.
Examples:

 int (e.g., 10)


 float (e.g., 3.14)
 str (e.g., "hello")
 bool (e.g., True, False)

2. List different control flow statements in Python.

Answer:
Control flow statements in Python include:

 if, elif, else


 for loop
 while loop
 break
 continue
 pass

3. What is a tuple? Mention its characteristics.

Answer:
A tuple is an ordered and immutable collection of elements.
Characteristics:

1. Defined using ()
2. Allows duplicate values
3. Cannot be modified after creation
4. Supports indexing
[Link] between list and tuple.

Answer:

Feature List Tuple


Mutability Mutable Immutable
Syntax [] ()
Performance Slower Faster
Use Dynamic data Fixed data

5. Explain list comprehension with an example. Explain list comprehension with an example.

Answer:
List comprehension provides a concise way to create lists.

Syntax:

[expression for item in iterable if condition]

Example:

squares = [x*x for x in range(5)]

Output: [0, 1, 4, 9, 16]

6. What is NumPy?

Answer:
NumPy is a Python library used for numerical computations.
It provides:

1. Multidimensional array (ndarray)


2. Fast mathematical operations
3. Linear algebra functions

[Link] is a DataFrame in Pandas?

Answer:
A DataFrame is a two-dimensional labeled data structure in Pandas.
Features:

1. Rows and columns


2. Can store different data types
3. Similar to a table or spreadsheet

[Link] GroupBy operation in Pandas.

Answer:
GroupBy is used to split data into groups, apply operations, and combine results.
Steps:

 Split data
 Apply function (sum, mean, etc.)
 Combine results

Example:

[Link]('column').sum()

9. Explain data cleaning in Pandas.

Answer:
Data cleaning involves handling missing or incorrect data.
Methods:

 dropna() – remove missing values


 fillna() – replace missing values
 replace() – substitute values

10. Explain the purpose of data visualization.

Answer:
Data visualization helps in:

 Understanding data patterns


 Identifying trends and outliers
 Presenting data clearly

Common plots:

 Bar chart
 Line chart
 Histogram

You might also like