0% found this document useful (0 votes)
36 views

Data Science With Python Previous Questions Answers

Uploaded by

Surinder Kaur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Data Science With Python Previous Questions Answers

Uploaded by

Surinder Kaur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Ques:- Write about Statistical Interference in Data Science ?

Ans:-
Statistical inference is the process of using data from a sample to make generalizations about a
larger population. It involves applying probability theory and statistical techniques to estimate
unknown parameters, test hypotheses, and assess relationships between variables.

Types of Statistical Inference

1. Estimation:
○ Point Estimation: Provides a single value as an estimate of a population
parameter (e.g., sample mean as an estimate of the population mean).
○ Interval Estimation: Provides a range of values (confidence interval) that is
likely to contain the population parameter.
2. Hypothesis Testing:
○ Used to test assumptions (null hypothesis) about a population parameter.
○ Involves determining whether observed data is consistent with the null hypothesis
or if the alternative hypothesis should be accepted.
3. Regression Analysis:
○ Examines relationships between variables.
○ Used for prediction and understanding the strength and direction of associations.
4. Bayesian Inference:
○ Incorporates prior knowledge or beliefs into the analysis through Bayesian
probability.
○ Updates the probability of a hypothesis as new evidence is introduced.

Why Statistical Inference used in Data Science :-

Data Exploration and Understanding:

● Helps summarize data using descriptive statistics.


● Provides insights into data distribution and variability.

Decision-Making:

● Enables data-driven decisions by providing confidence in the conclusions drawn from a


sample.

Predictive Modeling:

● Forms the basis for machine learning models by quantifying uncertainty and validating
model performance.
Experimentation (A/B Testing):

● Statistical inference is crucial in experimental design to test the effectiveness of


changes or new features.

Common Techniques in Statistical Inference

1. Z-test and T-test: Used to compare means.


2. Chi-square Test: Used for categorical data analysis.
3. ANOVA (Analysis of Variance): Used to compare means across multiple groups.
4. Confidence Intervals: Used to quantify the uncertainty of parameter estimates.

Ques:- Write about Running Python Scripts ?

Ans:- Python is a well-known high-level programming language. The Python script is a file
containing Python-written code. The file containing Python script has the extension ‘.py’ or
can also have the extension ‘.pyw’ if it is being run on a Windows 10 machine.

Methods to Run a Script in Python


There are various methods to Run a Python script, we will go through some generally used
methods for running a Python script:

● Interactive Mode

● Command Line

● Text Editor (VS Code)

● IDE (PyCharm)

1. Run Python Script Interactively:


Example1: Using Print Function
Run the following line in the interactive mode:
print('Hello World !')

Example 2: Using Interactive Execution


Run the following lines one by one in the interactive mode.
name = "Aakash"
print("My name is " + name)
2. Run Python Script by the Command Line:

Example 1: Using Script Filename


To run Python in the terminal, store it in a ‘.py’ file in the command line, we
have to write the ‘python’ keyword before the file name in the command
prompt. In this way we can run Python programs in cmd.
python hello.py

You can write your own file name in place of ‘hello.py’.

Output:

3. Run a Script in Python using a Text Editor :

To run Python script on a text editor like VS Code (Visual Studio Code) then you will have to do
the following:

● Go to the extension section or press ‘Ctrl+Shift+X’ on Windows, then search and install

the extension named ‘Python’ and ‘Code Runner’. Restart your vs code after that.

● Now, create a new file with the name ‘hello.py’ and write the below code in it:

print('Hello World!')

● Then, right-click anywhere in the text area and select the option that says ‘Run Code’ or

press ‘Ctrl+Alt+N’ to run the code.


Run Python Scripts using an IDE

To run Python script on an IDE (Integrated Development Environment) like

PyCharm, you will have to do the following:

● Create a new project.

● Give a name to that project as ‘GfG’ and click on Create.

● Select the root directory with the project name we specified in the

last step. Right-click on it, go to New, anto, and click on the ‘Python

file’ option. Then give the name of the file as ‘hello’ (you can specify

any name as per your project requirement). This will create a

‘hello.py’ file in the project root directory.


Ques:- Write about Membership Operations?

Ans:- Python Memebership Operators are ➖

Python IN Operator :- The in operator is used to check if a character/substring/element exists


in a sequence or not. Evaluate to True if it finds the specified element in a sequence otherwise

False.
Python NOT IN Operator :- The ‘not in’ Python operator evaluates to true if it does not
find the variable in the specified sequence and false otherwise.

Uses Membership Operations in Data Science

Data Cleaning:

● Check if values are missing or invalid in a dataset.

Data Filtering:

● Select rows or columns based on specific criteria.

Validation:

● Ensure that categorical values belong to a predefined set of valid options.


Text Analysis:

● Detect the presence of keywords or phrases in textual data

Set Operations:

● Quickly check overlapping or disjoint elements between two collections using in

or not in with sets.

Iterative Operations:

● Optimize loops by ensuring that membership checks are performed on efficient


collections like sets.

Ques:- Write about Calling Functions?

Ans:-

Functions are an essential part of programming in Python, allowing you to encapsulate code into
reusable blocks. Understanding how to call a function correctly is fundamental to writing effective
Python code. In this article, we will explore the various ways to call functions in Python, including
passing arguments, returning values, and handling exceptions.
Ques:- What about Data Hiding?

Ans:- Data hiding is a part of object-oriented programming, which is generally used to


hide the data information from the user. It includes internal object details such as data
members, internal working. It maintained the data integrity and restricted access to the
class member. The main working of data hiding is that it combines the data and
functions into a single unit to conceal data within a class. We cannot directly access the
data from outside the class.

This process is also known as the data encapsulation. It is done by hiding the working
information to user. In the process, we declare class members as private so that no other
class can access these data members. It is accessible only within the class.

Data Hiding in Python

Python is the most popular programming language as it applies in every technical


domain and has a straightforward syntax and vast libraries. In the official Python
documentation, Data hiding isolates the client from a part of program implementation.
Some of the essential members must be hidden from the user. Programs or modules
only reflected how we could use them, but users cannot be familiar with how the
application works. Thus it provides security and avoiding dependency as well.
Advantages of Data Hiding:
Ques:- Write about Installing Packages Via PIP?
Ans:-
Ques:- Write about Reading and Writting Files ?
Ans:-
Ques:- Explain about Data Science Process?

Ans:-
Ques:- Write about Exploratory Data Analysis?

Ans:-Exploratory Data Analysis (EDA) is a crucial initial step in data science projects. It involves
analyzing and visualizing data to understand its key characteristics, uncover patterns, and identify

relationships between variables refers to the method of studying and exploring record sets to

apprehend their predominant traits, discover patterns, locate outliers, and identify relationships

between variables. EDA is normally carried out as a preliminary step before undertaking extra

formal statistical analyses or modeling.

Types of Exploratory Data Analysis:-


Ques:- Explain about Lists operations?
Ans:-
Ques:- Explain about Methods of OS Module?

Ans:-
Python OS module provides the facility to establish the interaction between the user and
the operating system. It offers many useful OS functions that are used to perform
OS-based tasks and get related information about operating system.
The OS comes under Python's standard utility modules. This module offers a portable
way of using operating system dependent functionality.

The Python OS module lets us work with the files and directories.

You might also like