AI Ethics and Applications Overview
AI Ethics and Applications Overview
Unit 1
Exercise Time Pg. 144
Tick the correct choice.
1. AI project cycle
2. Problem scoping
3. Data acquisition
4. AI development
5. Rule-based approach
1. (c) Domains
2. (b) Data science
3. (a) Virtual assistant
4. (c) Chatbot
5. (d) All of the above
1. The three domains of AI are – Data, Natural Language Processing and Computer Vision.
2. The tasks of NLP are –
(a) Text classification
(b) Named entity recognition
(c) Speech recognition
(d) Text generation
3. Three applications of computer vision are autonomous vehicles, facial recognition and surveillance
systems.
Exercise Time Pg. 155
Fill in the blanks.
1. Ethics
2. AI ethics (or ethical guidelines)
3. Unbiased
4. Privacy
1. Ethics are rules or principles set by society or a profession to decide what is right or wrong. For
e.g., A doctor follows medical ethics to keep patient information private.
Morals are personal beliefs or values about what is right or wrong. For e.g., a person helps the
poor because they believe it is the right thing to do.
2. Principles of AI are the basic rules that guide the safe and responsible use of Artificial
Intelligence. They ensure AI benefits humans and does not cause harm. Main principles include:
(a) Fairness – AI should treat everyone equally without bias.
(b) Transparency – The working of AI should be clear and understandable.
(c) Privacy – AI must protect user data and personal information.
(d) Accountability – Developers and users should take responsibility for AI’s actions.
(e) Safety – AI systems should be secure and not harm people or the environment.
3. An ethical framework for AI is a set of guidelines that help design, develop, and use Artificial
Intelligence in a responsible and fair way. It ensures that AI systems respect human rights and
do not cause harm.
4. Bioethics in AI focuses on the ethical issues that arise when using AI in healthcare and life
sciences. It ensures that AI systems are developed and used in a way that:
(a) Respects patient autonomy – Patients have control over decisions involving AI.
(b) Promotes beneficence – AI improves diagnosis, treatment, and healthcare outcomes.
(c) Avoids harm (non-maleficence) – AI minimizes errors, biases, and risks to patients.
(d) Ensures justice – AI provides fair and equal access to healthcare services.
(e) Protects privacy and accountability – Sensitive medical data is handled securely, and
developers are responsible for AI decisions.
1. Where
2. Testing
3. Artificial Intelligence
4. Artificial Intelligence
5. Training
6. Frameworks
7. Virtue ethics
8. Healthcare
Short Answer Questions.
1. Defines
(a) Problem Scoping: It is the process of identifying and understanding the problem to be solved,
including the stakeholders involved and the goals of the project.
(b) Data Exploration: The process of analyzing and summarizing data to understand its structure,
patterns, and quality before building AI or data models is called data exploration.
(d) Data Science: The field that combines statistics, programming, and domain knowledge to extract
insights and knowledge from data is known as data science.
(e) Computer Vision: It is a branch of AI that enables machines to interpret, analyze, and understand
visual information from the world, such as images or videos.
2. Chatbots: Automated programs that interact with users through text or voice to answer
questions, provide support, or perform tasks. For e.g., Customer service chatbot on a website.
Virtual Assistants: AI-based assistants that help users perform tasks, manage schedules, or
access information using voice or text commands. For e.g., Siri, Google Assistant, Alexa.
3. Ethical frameworks in AI are specific sets of guidelines or standards that focus on moral and
ethical considerations when developing AI technologies. These guidelines focus on promoting
fairness, accountability, transparency, and privacy throughout the entire AI development
process.
4. Bioethics is the study of ethical issues in life sciences, medicine, and healthcare, focusing on
moral questions like patient rights, safety, and fairness. It ensures that AI in healthcare is used
responsibly, protecting patient privacy, promoting fairness, avoiding harm, and supporting
ethical medical decisions. It deals with moral questions arising from medical advancements,
genetic research, healthcare policies, and human rights in healthcare.
Unit 2
Exercise Time Pg. 166
Fill in the blanks.
5. (a) preprocessing
1. Rule-based
2. Learning-based
3. Labelled
4. Regression
5. Clustering
6. Reinforcement
7. Artificial neural networks
8. Convolutional Neural Network
1. Rule-based approach works on a fixed set of predefined rules and logic created by humans. It
does not learn from data. For e.g., a chatbot replying using “if–then” rules.
Learning-based approach learns from data and improves its performance over time without
being explicitly programmed. For e.g., a chatbot that learns from user interactions to give better
responses.
2. Supervised learning is a type of machine learning where the model is trained using labeled data.
The model learns to map inputs to outputs by analysing the patterns in the training data. Once
trained, it can make predictions or decisions on new, unseen data.
3. Association is a type of unsupervised learning used to find relationships or patterns between
items in large datasets. It identifies how different variables or items are related based on their
co-occurrence. For e.g., in an online shopping website, association learning can find that people
who buy mobile phones often buy phone covers and screen protectors. This helps the system
give “Frequently Bought Together” suggestions to increase sales.
1. Deep learning
2. Rule-based
3. Learning-based
4. Classification
5. Unsupervised
6. Reinforcement
7. Neurons
1. Defines
(a) Deep Learning - Deep learning is a branch of machine learning that uses artificial neural
networks with many layers to analyze data, learn complex patterns, and make decisions
automatically. For e.g., it is used in speech recognition, image classification, and self-
driving cars.
(b) Unsupervised Learning - Unsupervised learning is a type of machine learning algorithm
where the model learns from unlabeled data without any specific target variable or class
labels.
(c) Convolutional Neural Network - A Convolutional Neural Network (CNN) is a specialized
type of deep learning model designed for processing image and video data. CNNs are
highly effective in tasks like object recognition, face detection, and handwritten digit
recognition.
2. In reinforcement learning, the model learns optimal actions by interacting with an environment
and receiving feedback in the form of rewards or penalties. The model explores the
environment, takes actions, and adjusts its behavior based on the received rewards to maximize
cumulative rewards over time.
3. In supervised learning, a classification algorithm learns from labeled data (data that already has
known categories or outputs). It studies the relationship between input features and their
corresponding labels. After training, it can predict the class or category of new, unseen data. For
e.g., if an algorithm is trained with emails labeled as “spam” or “not spam”, it learns the patterns
and later classifies new emails into these two categories.
4. Deep learning can be divided into three main categories — supervised learning, unsupervised
learning, and reinforcement learning.
(a) Supervised Learning - In supervised learning, the model is trained using labeled data
where both input and correct output are known. It learns the relationship between
them to make accurate predictions, such as classifying emails as spam or not spam.
(b) Unsupervised Learning - In unsupervised learning, the model works with unlabeled data
and tries to find hidden patterns or group similar data items. For example, it can group
customers based on their shopping habits.
(c) Reinforcement Learning - In reinforcement learning, the model learns by interacting
with its environment and receiving feedback in the form of rewards or penalties. Over
time, it learns the best actions to achieve a goal, like training a robot to walk or teaching
an AI to play a game.
5. Neural networks are needed in AI because they help machines learn from data, recognize
complex patterns, and make intelligent decisions similar to the human brain. They are especially
useful for tasks like image recognition, speech processing, and language translation, where
simple algorithms are not effective.
2.
3. AI makes decisions using Artificial Neural Networks. ANNs consist of artificial neurons, known as
units, which are organized into multiple layers forming the complete network. These layers can
contain anywhere from a few to millions of units, depending on the complexity of the network
required to learn hidden patterns in the dataset. Mostly, an ANN includes three main layers that
work together analyze data, recognize patterns, and make predictions.
The input layer is the first stage of an Artificial Neural Network (ANN), where raw data is fed into
the system.
The hidden layers are responsible for analyzing and learning from the input data. The more
hidden layers a network has, the better it can understand complex patterns.
The output layer is the final stage of an ANN, where the processed information is used to make a
decision or prediction.
Unit 3
Exercise Time Pg. 188
Name the following.
1. Model evaluation
2. Overfitting
3. Underfitting
1. Model evaluation is the process of assessing how well a machine learning model performs on a
given dataset, usually by comparing its predictions with actual outcomes.
2. Reasons for model evaluation are as follows –
(a) Measuring Performance - It shows how well a model predicts outcomes by using various
metrics like accuracy, precision, recall, and F1 score.
(b) Comparing Models - Evaluation helps compare different models to choose the one that
works best for the given data
(c) Avoiding Overfitting and Underfitting - Evaluation helps spot these issues by testing the
model on unseen data.
1. Single
2. Splitting
3. Train-test split
4. training set and testing set
5. training
1. Accuracy
2. High-quality data
3. Hyperparameters
4. Bias
5. Error
6. 0 and 1
1. Accuracy is a measure of how often a machine learning model makes correct predictions. It is
the percentage of correct predictions out of the total predictions made.
Error indicates how often a model makes incorrect predictions. It shows the difference between
the predicted values and the actual values.
2. Model accuracy is important in machine learning because it helps check how well AI models
work and how reliable they are. Three reasons for the importance of accuracy are-
(a) Performance Evaluation: Shows how well the model performs and the reliability of its
predictions.
(b) Simple Measurement: Provides a clear and easy-to-understand measure of the model’s
effectiveness.
(c) Error Indicator: High accuracy implies fewer errors, helping gauge the model’s precision.
3. Three challenges in accuracy are –
(a) Data Quality Issues: Poor-quality data, which includes missing values, duplicates, and
irrelevant features — can mislead AI models, causing inaccurate predictions.
(b) Overfitting: Overfitting happens when the model learns training data instead of learning
patterns, leading to poor performance on new data.
(c) Underfitting: A model is underfitted when it is unable capture patterns in data, causing low
accuracy on both training and test sets.
4. Four types of errors in AI models are –
(a) Bias Errors: These errors occur when a model learns from unfair or incomplete data.
(b) Variance Errors: Variance errors occur when a model overfits the training data.
(c) Data Quality Errors: These errors arise when the training data contains noise, missing values,
or inconsistencies.
(d) Model Complexity Errors: If a model is too simple (underfitting), it cannot learn the
underlying patterns in the data.
1. Classification
2. Precision
3. False
4. F1 score
5. prediction and reality
1. Classification is a type of machine learning task where the goal is to sort data into different
categories or classes. The model learns from labeled data and then predicts the class of new,
unseen data.
2. Some important classification metrics are – Accuracy, Precision, Recall and F1 Score.
3. The F1 score is an evaluation metric used in machine learning and AI to provide a balance
between precision and recall. The F1 score is the mean of precision and recall and is calculated
using the following formula:
2∗(Precision∗Recall)
F 1 Score=
(Precision+ Recall)
1. Evaluation
2. Four
3. True positive
True Positives(TP)
4. Precision=
True Positives ( TP ) + False Positives ( FP )
True Positives(TP)
5. Recall=
True Positives (TP)+ False Negatives(FN )
State whether true or false
1. False
2. True
3. False
4. False
5. True
1. Defines
(a) Evaluation - Evaluation means measuring how good a model is at making predictions or
decisions. It is the final stage of AI project cycle. It helps to understand if the model is
accurate, reliable, and ready to be used.
(b) Overfitting - Overfitting happens when the model learns training data instead of learning
patterns, leading to poor performance on new data.
(c) Precision - Precision is an evaluation metric used in machine learning and AI to assess the
performance of a model on a classification task. It measures the proportion of true positive
predictions among all the instances that the model predicted as positive.
(d) Classification - Classification is a type of machine learning task where the goal is to sort data
into different categories or classes. The model learns from labeled data and then predicts
the class of new, unseen data.
2. Recall measures how many of the actual positive cases were correctly identified by the model. It
focuses on the ability to find all positive instances in the data.
Precision measures how many of the predicted positive results are actually correct. It focuses on
the quality of positive predictions made by the model.
3. True Negative (TN): It refers to the cases where the AI model correctly predicts a negative
outcome. For e.g., the model correctly identifies an email as not spam.
False Positive (FP): It refers to the cases where the AI model incorrectly predicts a positive
outcome when it is actually negative. For e.g., the model wrongly marks a normal email as spam.
4. A confusion matrix is a table used to evaluate the performance of an AI or machine learning
model. It shows the counts of true positives, false positives, true negatives, and false negatives,
helping to understand how well the model’s predictions match the actual results.
3. The train-test split is a key step in machine learning used to evaluate a model’s performance. It
involves dividing the data set into two parts – one for training the model and another for testing
its performance. The steps are as follows:
(a) Collect the data: Start with a complete dataset containing input features (X) and output
labels (y).
(b) Prepare your data: Before splitting the data, ensure it is clean, organized, and suitable for
modeling. The data should have: features (X) and target variable (y).
(c) Split the data: Divide the dataset into two subsets – training set and testing set. This step
prevents the model from memorizing the data, helping it generalize better.
(d) Train the model: Now, you use the training set to teach the model patterns in the data. The
model adjusts its internal parameters based on this data.
(e) Evaluate the model: Finally, test the model on the test set. It checks how well the model
performs on new, unseen data, giving a fair estimate of its accuracy.
4. Solutions:
(TP+TN )
Accuracy=
(TP+TN + FP+ FN )
(70+5) 75
= = = 0.75
(70+15+10 +5) 100
= 75%
TP
Precision=
( TP ) + ( FP )
= 0.875
70 70
¿ ¿
70+10 80
= 87.5%
TP
Recall=
TP+ FN
70 70
= = = 0.8235
70+15 85
= 82.35%
2∗(0.875 ×0.8235 )
F 1 Score= = 0.848
(0.87+ 0.8235 )
= 84.8%
Unit 4
Exercise Time Pg. 188
Fill in the blanks.
1. data science
2. no code
3. security
4. conventional
1. (b) No code
2. (c) Highly expensive
3. (a) High code
1. No-code tools
2. Lobe
3. Feature selection
4. Tree viewer
5. Confusion Matrix
1. True
2. False
3. True
4. True
5. False
1. Defines
(a) No-Code AI - No-code AI refers to artificial intelligence tools and platforms that allow users
to build, train, and deploy AI models without writing any code. These platforms use simple,
user-friendly interfaces like drag-and-drop features, making AI development accessible to
people without programming skills.
(b) Outliers - Outliers are data points that are very different from others in a dataset. They can
affect AI models, so identifying and handling them is important to prevent biased
predictions.
(c) Statistical Sampling - Statistical sampling is a technique used in data analysis where a smaller
group (sample) is selected from a larger population to make inferences about the whole
population.
2. The difference between code, low code and no code AI tools is as follows:
3. MS-Excel is useful for statistical data because it allows users to organize, analyze, and visualize
data easily.
(a) It provides functions and formulas for calculating mean, median, mode, standard deviation,
and other statistical measures.
(b) Users can create charts and graphs to visualize data trends and patterns.
(c) Tools like PivotTables help summarize large datasets for analysis.
(d) It supports data sorting, filtering, and basic predictive analysis, making it a convenient tool
for statistical work.
4. No code AI tools are used by non-technical individuals, such as doctors, architects, and
musicians, to easily create accurate AI models without any coding knowledge. This empowers
professionals from various fields to leverage AI technology for their work, making innovation
faster and simpler.
5. Data exploration widgets allow you to look at your data in different ways, like scatter plots or
histograms, to see patterns or trends. It includes options such as:
(a) Scatter Plot: Visualizes the relationship between two variables in the data.
(b) Data Table: Allows for manual inspection and exploration of data.
(c) Distributions: Displays histograms and other statistical distributions of variables.
3.
(i) Use the File widget to load your dataset (CSV, Excel, SQL, etc.).
(ii) Connect it to the Data Table widget to view the customer details in a tabular form.
(iii) Use the Statistics or Box Plot / Histogram widgets to explore distributions of age, income,
purchase frequency, and product preferences. This helps identify patterns, trends, and
outliers.
(i) Use the k-Means or Hierarchical Clustering widget to group customers into clusters.
(ii) Specify the number of clusters (k) based on business needs or by experimenting with
different values.
(iii) The algorithm will assign each customer to a cluster based on similarity in features like age,
income, and purchase behavior.
(i) Connect the clustering output to the Silhouette Plot or Evaluate Clustering widget.
(ii) Check metrics such as silhouette score or intra-cluster vs inter-cluster distances to see if the
clusters are well-separated and meaningful.
(i) Use Scatter Plot, Box Plot, or Heat Map widgets to visualize the clusters.
(ii) Color-code clusters to easily compare age, income, or product preferences across groups.
(iii) This visualization helps the marketing team understand customer segments and design
targeted campaigns for each cluster.
Unit 5
Assessment Time Pg. 258
Fill in the blanks.
1. True
2. False
3. True
4. True
1. Defines
(a) Computer Vision - Computer vision is the branch of artificial intelligence (AI) that focuses on
developing and utilizing digital systems to process, analyze and interpret visual data. The
goal of computer vision is to enable computing devices to correctly identify an object or
person in a digital image and take appropriate action.
(b) Convolutional Neural Networks - Convolutional Neural Networks (CNNs) are a type of deep
learning model specifically designed for processing and analyzing visual data, such as images
and videos.
(c) Grayscale Images - Grayscale images are a type of digital image that contains only shades of
gray, ranging from pure black to pure white, with no color information. In grayscale images,
each pixel is represented by a single intensity value, which indicates the brightness or
luminance at that specific location. These images have each pixel of size 1 byte having a
single plane of 2D array of pixels.
2. Convolutional Layer - The convolutional layer in a neural network extracts features from the
input data using filters (kernels). It detects patterns like edges, textures, or shapes in images and
produces feature maps that highlight these patterns.
Pooling Layer - The pooling layer reduces the spatial size of the feature maps produced by
convolutional layers. It helps lower computation, prevent overfitting, and retain the most
important information. Common types include max pooling and average pooling.
3. Please delete this question.
4. In retail industry Computer vision helps retailers analyze visual data to improve operations,
customer experience, and sales. It is used for:
(a) Customer Behavior Analysis: Tracking movements and interactions in stores to understand
shopping patterns.
(b) Inventory Management: Monitoring stock levels on shelves in real time.
(c) Checkout Automation: Enabling cashier-less stores through object and barcode recognition.
(d) Product Recommendations: Recognizing products and suggesting related items.
(e) Loss Prevention: Detecting theft or suspicious activities.
(a) Feature Extraction: Kernels detect features like edges, corners, textures, or shapes.
(b) Highlight Important Information: By emphasizing patterns in the image, kernels help the
CNN focus on relevant visual information.
(c) Create Feature Maps: The convolution of the kernel with the image produces a feature map,
which represents the presence of a specific feature at different locations.
Unit 6
Exercise Time Pg. 267
Answer the following questions.
1. Semantic
2. Grammatical
3. Semantic
4. Coreference, discourse
5. Pragmatic
1. Syntactic analysis helps to determine the sentence's syntax and identify the hierarchical
structure of phrases and clauses. It includes part-of-speech tagging i.e., assigning grammatical
parts of speech to each word, named entity recognition which means identifying entities like
names of people, places, organizations, etc., and identifying other linguistic features like tense,
gender, number, etc. Syntax analysis ensures that the structure of a particular piece of text is
proper.
2. Coreference Resolution is a process in Natural Language Processing (NLP) used to identify when
different words or phrases refer to the same entity in a text. For e.g., in the sentence — "Riya
went to the park because she loves jogging". The words “Riya” and “she” refer to the same
person. Coreference resolution helps computers understand context and maintain continuity in
text, which is important for tasks like text summarization, question answering, and dialogue
systems.
3. Sentiment analysis is a method of determining whether a block of text is positive, negative, or
neutral. It is used to understand public sentiment in order to analyse it for commercial purposes.
It not only categorises the sentiments as to positive, negative, and neutral, but also emphasises
on emotions, such as happiness, sadness, and anger.
4. Pragmatic analysis is concerned with interpreting the meaning of text beyond its literal sense,
considering the speaker's or writer's intentions, and the context in which the language is used.
This phase deals with tasks like speech act recognition, sentiment analysis, and determining the
underlying intent or emotion in the text.
Exercise Time Pg. 276
State whether true or false.
1. True
2. False
3. True
4. False
5. False
6. False
7. False
1. Chatbot is a short form of Chat Robot. These are AI-powered conversational agents designed to
simulate human-like interactions with users through text-based or voice-based conversations.
They use natural language processing (NLP) and to understand user input and provide
appropriate responses.
2. Rule-based chatbots are also known as script bot. These chatbots operates using a predefined
set of rules and scripted responses. These chatbots are programmed with specific responses
based on keywords or patterns in the user's input. They follow a fixed algorithm to determine
the appropriate response based on the user's query. Script bots are relatively simple and lack
the ability to learn or adapt beyond the programmed rules.
3. Differences between script bot and smart bot are:
4. The chatbot EVA in the HDFC Bank app helps customers with tasks like checking account
balances, viewing recent transactions, finding branch or ATM locations, and answering banking-
related queries quickly through chat.
1. True
2. False
3. True
4. True
5. True
4. Virtual Assistant: A virtual assistant is an AI-powered application that helps users perform tasks
using voice and text commands. It uses Natural Language Processing (NLP) and machine learning
to understand complex instructions, manage schedules, play music, provide information, or
control smart devices. Examples include Siri, Alexa, and Google Assistant.
Chatbot: A chatbot is a computer program designed to simulate human conversation, usually
through text-based interaction. It is mainly used in customer service, banking, and e-commerce
to answer queries, provide information, or assist users. Unlike virtual assistants, chatbots usually
follow predefined scripts and handle limited tasks.
5. Text normalization – It is also known as text preprocessing or text standardization. This step
involves transforming and standardizing text data into a common, consistent format. The main
goal of text normalization is to reduce the complexity and variations in text, making it easier for
NLP models to understand and process the text accurately.
Sentence segmentation – It is also known as sentence boundary detection or sentence
tokenization. It is a task of NLP that involves dividing a text or paragraph into individual
sentences. The goal of sentence segmentation is to identify the boundaries that separate one
sentence from another, creating a list of discrete sentences within the input text.
(a) Syntactic analysis - This step involves analyzing the grammatical structure of sentences to
understand the relationships between words. It helps to determine the sentence's syntax
and identify the hierarchical structure of phrases and clauses.
(b) Semantic analysis – It aims to understand the meaning of words and sentences in the given
context. The focus is mostly on the literal meaning of words, phrases, and sentences.
(c) Disclosure analysis - In this phase, the analysis expands to a broader context, focusing on
understanding the relationship between sentences or larger pieces of text.
(d) Pragmatic analysis - Pragmatic analysis is concerned with interpreting the meaning of text
beyond its literal sense, considering the speaker's or writer's intentions, and the context in
which the language is used. This phase deals with tasks like speech act recognition,
sentiment analysis, and determining the underlying intent or emotion in the text.
3. AI plays a major role in sentiment analysis by helping computers understand and interpret the
emotions and opinions expressed in human language. Using Natural Language Processing (NLP)
and Machine Learning (ML) techniques, AI can analyze text, speech, or social media posts to
determine whether the sentiment is positive, negative, or neutral. For example, AI models can
study customer reviews, tweets, or feedback to identify how people feel about a product or
service. This helps companies understand customer satisfaction, improve their services, and
make data-driven decisions. In short, AI enables machines to detect and analyze human
emotions from language, making communication analysis more accurate and insightful.
Unit 7
Exercise Time Pg. 299
Write algorithm and draw flowchart for the following:
Step 1: Start
Step 7: Stop
Step 1: Start
Step 7: Stop
Step 1: Start
1. Script
2. identifier
3. complex
4. type casting
5. print()
1. Python is used in AI development because it is simple, powerful, and has many useful libraries.
Python’s simple syntax makes it easy to read and write code. It also allows developers to focus
on solving AI problems instead of complex programming rules. It has a large collection of
libraries and frameworks like TensorFlow, Keras, PyTorch, NumPy, and Scikit-learn that make
building AI models faster and easier. Python supports machine learning, deep learning, data
analysis, and natural language processing, which are key parts of AI.
For e.g.,
x = 15
y = 20
name = “Sumit”
x = y = 10
b. Multiple Variable Assignment: Python allows you to assign values to multiple variables in
a single line. You can separate the variable names and values with commas. For e.g.
name, total_marks, percentage = “Akshay”, 478, 95.6
5. Implicit Type Conversion: Implicit type conversion, also known as type conversion, is done
automatically by the Python interpreter. It happens when Python converts one data type into
another to perform an operation. For e.g., in the expression x = 5 + 2.5, the integer 5 is
automatically converted into a float before addition, and the result x becomes 7.5. This type of
conversion helps avoid errors but gives less control to the programmer.
Explicit Type Conversion: Explicit type conversion, also known as type casting, is done manually
by the programmer using type conversion functions like int(), float(), str(), etc. For example, x =
int(2.8) converts the float value 2.8 into an integer 2. This method gives more control over how
data is converted but must be used carefully to avoid data loss.
1. Anaconda is a free and open source distribution of the Python programming language along
with a collection of pre-installed packages and tools. It is developed by Anaconda Inc, a
company that specializes in Python development. It is designed for data science and provides a
convenient way to set up and manage Python environments.
Anaconda Prompt is a command-line interface that comes with Anaconda. It is used to run
Python programs, manage environments, and install or update packages
2. Jupyter Notebook is an open-source web application and was formerly known as IPython
Notebook. It is an interactive web-based environment where a single document contains
Pyhton code, output window, explanations, formulas, charts etc. This tool provides facility for
creating and sharing documents that contain live code, equations, visualizations, and narrative
text.
3. In Python and Jupyter Notebook, a kernel is a program that runs the code written in a notebook
cell. It executes the code, keeps track of variable values, and returns the output to the
notebook. For e.g., when you write and run Python code in Jupyter Notebook, the Python
kernel processes the commands and shows the results. If you restart the kernel, all stored
variables and outputs are cleared. Thus, kernel is the engine that executes your code and
manages program execution in tools like Jupyter Notebook.
1. List: A list in Python is a collection of items that can be changed after creation. It is mutable,
meaning you can add, remove, or modify elements. Lists are written using square brackets [ ].
For example -
Tuple: A tuple in Python is a collection of items that cannot be changed after creation. It is
immutable, meaning you cannot add, remove, or modify elements once it is created. Tuples are
written using parentheses ( ).
For example -
2. In Python, you can create list by placing all the items (elements) inside square bracket [] separated
by commas. For e.g.,
A list can also have another list as an item. This is called nested lists. For e.g.,
3. Slicing a list in Python refers to the process of extracting a subset or a portion of elements from the
original list. It allows you to create a new list containing only the elements you need, based on
specified indexes or a range of indexes. The general syntax for list slicing is:
new_list = original_list[start:stop:step]
4. Tuples are immutable and hence they do not allow deletion of a part of it. Entire tuple gets deleted
by the use of del() method.
5. List elements can be deleted using remove() and pop() functions. The remove() method removes the
first occurrence of a specified element. It implies that if there are duplicate values in a list, only one
value will be removed. The pop() method removes the element at a specified index and returns it. If
no index is provided, it removes and returns the last element.
For e.g.,
marks = 75
print("Grade: A")
print("Grade: B")
print("Grade: C")
else:
print("Grade: D")
The program checks the first condition marks >= 90. If it is True, it executes that block and skips the rest.
If the first condition is False, it checks the next condition marks >= 75. This continues until a condition is
True or the else block is executed if none are True. In this example, since marks = 75, the output will be:
‘Grade: B’.
2. In Python, a for loop is used to iterate over a sequence such as a list, tuple, string, or range. The
number of iterations is usually known beforehand. The loop executes a block of code for each item
in the sequence. For e.g.,
for i in range(5):
print(i)
A while loop in Python is used to execute a block of code repeatedly as long as a condition is True.
The number of iterations is not necessarily known beforehand; it depends on the condition. For e.g.,
i=0
while i < 5:
print(i)
i += 1
3. Write a program to find numbers which are divisible by 9 and multiple 7 and are between 1000 and
1200.
Ans.
Ans.
for num in range(200, 301):
count = 0
if num % i == 0:
count += 1
print(num)
5. Write a program to input two numbers` and print their HCF and LCM.
Ans.
# Find HCF
hcf = 1
hcf = i
1. Logical
2. Real
3. Concatenates
4. True
5. Tuples
State whether true or false.
1. True
2. True
3. False
4. True
5. False
1. Defines
(a) Variable - A variable is a named location in memory and is used to store data. A variable in a
python program gives data to the computer for processing. Python interpreter allocates
memory based on the data type of a variable., and determine what can be stored in the
reserved memory.
(b) Identifier - An identifier is a user defined name used to identify variables, functions, classes,
modules, or other objects. Identifiers are case-sensitive and must follow certain rules and
conventions
(c) Keyword - Python consists of some words which are pre-defined and carry a specific
meaning for the system by default. These words are known as keywords or reserved words.
Keywords cannot be changed at any point in time and should not be used in any other way,
such as using it as identifier. The keywords are case sensitive.
List Tuple
A list is mutable. i.e., elements can be changed, A tuple is immutable, i.e., elements cannot be
added, or removed. changed once created.
Defined using square brackets [ ]. Defined using parentheses ( ).
Slower compared to tuple for iteration. Faster compared to list for iteration.
Suitable when data needs to be modified. Suitable for fixed data that should not change.
Example: fruits = ["apple", "banana", "mango"] Example: colors = ("red", "green", "blue")
3. Logical operators are used to combine one or more conditional statement and returns Boolean
values (True or False). These are used to perform logical operations. Python supports three
logical operators – and, or, not.
4. Type conversion is the process of converting a value from one data type to another. Python
provides built-in functions and methods to facilitate type conversion. Python allows its users to
perform two types of conversions – explicit conversion and implicit conversion.
5. The input() statement is used to take input from the user during program execution. It reads
data entered by the user as a string. for e.g.,
name = input("Enter your name: ")
Since input() returns a string, you can convert it to an integer using the int() function. For e.g.,
3. The if-else statement is used to make decisions in a program. It allows the program to execute
one block of code if a condition is True and another block if the condition is False.
According to the given flowchart –
The program checks the condition after the if keyword.
If the condition is True, the code inside the if block runs, and the else block is skipped.
If the condition is False, the code inside the else block runs instead.
1. Write a Python code to input a number and check whether the number is divisible by 11 or not.
Code:
# Check divisibility by 11
if num % 11 == 0:
else:
Code:
Code:
cube = i ** 3
4. Write a Python program to print all prime numbers between 100 and 200.
Code:
count = 0
if num % i == 0:
count += 1
print(num)
5. Write a Python program to input name and marks of a student in five different subjects.
Calculate and print the total marks and percentage. The program should run until user enters
blank space in name.
Code:
while True:
print("Program ended.")
break
marks = []
[Link](mark)
total = sum(marks)
# Display results
6. Write a Python program to input the amount of shopping bill and print the gift according to the
following conditions:
Amount Gift
Less than 2500 No gift
Between 2500 and A shopping bag
5000
Above 5000 A pen drive
Code:
print("No gift")
A Convolutional Neural Network (CNN) is designed to process image data by leveraging its layered architecture, which extracts and learns complex features through convolutions. CNNs are effective for object and face recognition due to their ability to capture spatial hierarchies in images, such as edges, textures, and patterns, across multiple layers. This structure allows CNNs to automatically and efficiently learn increasingly abstract features of the input image, which is crucial for complex visual tasks .
Learning-based AI models offer several advantages over rule-based systems: they can adapt to new data without manual updates, process large amounts of complex data, improve accuracy over time, generalize from diverse examples, and generally provide more precise results in pattern recognition. However, drawbacks include interpretability challenges, large data requirements, risks of overfitting, and transparency issues. Additionally, they often require substantial resources for training and updating, and they might unintentionally perpetuate biases present in the training data .
Logical operators in Python—'and', 'or', and 'not'—are used to combine one or more conditional statements, returning Boolean values (True or False). They are essential for decision-making processes in programming as they facilitate complex condition evaluations, allowing programs to execute different blocks of code based on multiple conditions. For example, using 'and' ensures all conditions must be true, 'or' allows any condition to trigger a true result, and 'not' inverts a condition's truth value, enabling nuanced and precise control flows within the program .
Reinforcement learning differs from supervised learning primarily in the type of data input and learning process. In supervised learning, the model is trained on labeled data, with the correct input-output pairs provided, allowing it to map inputs to outputs based on those labels. In contrast, reinforcement learning does not use labeled input-output pairs. Instead, it learns optimal actions through interaction with an environment, receiving feedback via rewards or penalties. This feedback drives the learning process, where over time, the model aims to maximize cumulative rewards through exploration and action adjustments .
Developers face significant challenges in transparency and interpretability with AI models, especially deep learning models, due to their complexity and 'black box' nature. Understanding the reasoning behind a model's decisions can be difficult. This opacity can limit trust and complicate troubleshooting. Potential solutions include developing interpretability tools and frameworks, such as using interpretable models like decision trees as benchmarks, employing methods like LIME or SHAP for explaining model predictions, and focusing on designing models with simpler, more transparent architectures .
Supervised learning is best suited for problems where the desired output is known, specifically classification and regression tasks involving labeled datasets. It is effective for tasks like spam detection, diagnostics, and predictive analytics where specific outputs guide model training. Unsupervised learning, on the other hand, excels in exploring unlabeled data to uncover hidden patterns or structures, such as clustering similar data points or reduction of dimensionality. It is apt for applications like customer segmentation or anomaly detection, where patterns or groupings can be discovered without predefined labels .
Data biases in AI systems can significantly impact model predictions, particularly in learning-based approaches, by perpetuating and amplifying existing societal biases. These biases often originate from historical or unrepresentative training data, leading models to learn and reinforce undesirable biases, resulting in unfair or inaccurate outcomes. This is particularly concerning in sensitive applications such as credit scoring, hiring, or law enforcement, where biased predictions could harm marginalized groups or reinforce discriminatory practices. Addressing data biases is crucial for achieving fairness, accuracy, and ethical AI deployments .
Python is considered a flexible language for AI projects because it supports multiple programming paradigms—procedural, object-oriented, and functional programming—which cater to diverse AI development needs. This flexibility allows developers to choose the most suitable approach for their specific AI tasks, promoting efficiency and innovation. Additionally, Python's integration capabilities with other languages and tools further contribute to its versatility, making it widely popular among developers for building complex AI systems such as machine learning models and neural networks .
Python's extensive library ecosystem greatly benefits AI development by simplifying machine learning and data processing tasks. Libraries such as TensorFlow, Keras, PyTorch, NumPy, Pandas, and Scikit-learn provide pre-built modules and efficient algorithms for training models, processing data, and conducting complex analyses, thereby reducing development time and the need for custom solutions. These libraries offer robust, optimized functionalities for handling large datasets, performing numerical computations, and creating complex neural networks, making Python a preferred choice for AI developers .
Ethical frameworks for AI are implemented for several critical reasons: ensuring fairness and avoiding bias in AI decision-making, protecting privacy, preventing misuse of personal data, promoting transparency, and fostering accountability. They align AI development with societal values and human rights by reducing risks of harm to vulnerable groups and fostering trust and confidence. Moreover, these frameworks set clear standards for responsible AI deployment and use, thereby underpinning societal acceptance and ethical integrity in AI technologies .