0% found this document useful (0 votes)
51 views36 pages

AI Ethics and Applications Overview

Uploaded by

davishverma56
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)
51 views36 pages

AI Ethics and Applications Overview

Uploaded by

davishverma56
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

Answers

Unit 1
Exercise Time Pg. 144
Tick the correct choice.

1. (c) Problem scoping


2. (c) Both (a) and (b)
3. (b) Who, What, Where, Why?
4. (a) Stakeholder
5. (c) Training
6. (d) All of these
7. (a) Supervised

Fill in the blanks.

1. AI project cycle
2. Problem scoping
3. Data acquisition
4. AI development
5. Rule-based approach

Exercise Time Pg. 148


Tick the correct choice.

1. (c) Domains
2. (b) Data science
3. (a) Virtual assistant
4. (c) Chatbot
5. (d) All of the above

Answer the following questions

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

Answer the following questions.

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.

Assessment Time Pg. 155


Fill in the blanks.

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.

(c) Modelling: It is the process of creating a mathematical or computational representation of a real-


world problem or system, which can be used to analyze data, make predictions, or support decision-
making.

(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.

Long Answer Questions

1. Applications of data science are as follows:


(a) Healthcare Analytics: Data science is utilized in healthcare to analyze patient data,
electronic health records, and medical imaging to improve patient care, disease
diagnosis, treatment effectiveness, and drug discovery. It also helps in predicting disease
outbreaks, optimizing hospital operations, and personalized medicine.
(b) Financial Analysis: Data science is applied in the finance industry to analyze financial
data, predict market trends, optimize investment portfolios, detect fraud, and assess
risk. It involves techniques like algorithmic trading, credit scoring, and fraud detection to
make accurate financial predictions and decisions
(c) Social Media and Sentiment Analysis: Data science is used to analyze social media data,
such as tweets, posts, and comments, to understand public sentiment, conduct market
research, and manage brand reputation. Sentiment analysis techniques help in gauging
public opinion and sentiment towards products, services, or events.
2. Applications of NLP are –
(a) Email Filters: Spam filters are used to identify certain words or phrases that indicate a spam
message. Based on their content, the algorithm determines whether emails belongs to the
primary, social, or promotional categories.
(b) Chatbots and Virtual Assistants: NLP powers chatbot and virtual assistant systems, enabling
human-like conversations and automated customer support. It involves understanding user
queries, generating appropriate responses, and performing tasks based on natural language
interactions.
(c) Text Summarization: NLP techniques enable the automatic generation of brief summaries of
longer texts, helping users quickly understand the main points or key information. Text
summarization is used in news articles, research papers, and document summarization.
(d) Question Answering Systems: NLP algorithms process and understand questions in natural
language and provide relevant answers. Question answering systems are employed in
chatbots, virtual assistants, and information retrieval systems.
(e) Voice Assistants and Speech Recognition: NLP is used in voice assistants and speech
recognition systems to transcribe spoken language into written text and generate human-
like responses. It powers voice-controlled devices, speech-to-text applications, and voice
assistants like Siri, Alexa, and Google Assistant.
3. AI ethics refers to the moral principles and guidelines that govern the development,
deployment, and use of Artificial Intelligence. It ensures AI systems are designed and used in
ways that are fair, safe, transparent, and accountable, protecting human rights and society.
Issues Related to AI Ethics are -
(a) Bias and Fairness: AI systems can inherit biases from the training data, leading to unfair or
discriminatory decisions.
(b) Privacy: AI often uses large amounts of personal data, raising concerns about data
protection and confidentiality.
(c) Transparency: Many AI systems, especially deep learning models, act as “black boxes,”
making it hard to understand how decisions are made.
(d) Accountability: It can be unclear who is responsible if an AI system causes harm or makes a
wrong decision.
(e) Safety and Security: AI systems can malfunction or be exploited, posing risks to individuals
or society.
(f) Job Displacement: Automation through AI may replace human jobs, creating social and
economic concerns.
4. AI bias is a phenomenon that happens when a machine learning algorithm generates results that
are systematically prejudiced as a result of erroneous assumptions. Some examples of AI bias
are –
(a) If a recruitment AI is trained on past hiring data favoring one gender, it may unfairly reject
candidates of another gender.
(b) Some facial recognition systems perform poorly on darker-skinned individuals because the
training data had mostly lighter-skinned faces.
(c) An AI used by banks may deny loans to certain groups if the historical data shows biased
lending practices.
5. The reasons for need of ethical framework for AI are as follows –
(a) Ethical frameworks ensure AI systems are fair and unbiased in decision-making.
(b) They protect privacy and prevent misuse of personal data.
(c) Ethical guidelines promote transparency and accountability in AI processes.
(d) They help align AI development with societal values and human rights.
(e) Ethical frameworks reduce the risk of harm to vulnerable groups.
(f) They foster trust and confidence in AI technologies.
(g) They provide clear standards for responsible AI deployment and use.

Unit 2
Exercise Time Pg. 166
Fill in the blanks.

1. Artificial Intelligence (AI)


2. predictions or decisions
3. Structured
4. Machine Learning and Deep Learning
5. Data mining

Tick the correct choice.

1. (a) Structured data

2. (a) Deep Learning

3. (b) Meta data

4. (b) Artificial neural networks

5. (a) preprocessing

Exercise Time Pg. 175


Fill in the blanks.

1. Rule-based
2. Learning-based
3. Labelled
4. Regression
5. Clustering
6. Reinforcement
7. Artificial neural networks
8. Convolutional Neural Network

Answer the following questions.

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.

Assessment Time Pg. 181


Fill in the blanks.

1. Deep learning
2. Rule-based
3. Learning-based
4. Classification
5. Unsupervised
6. Reinforcement
7. Neurons

Short Answer Questions.

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.

Long Answer Questions.

1. Advantages of Learning Based approach are as follows:


(a) Adaptability: Learning-based models can adapt to new data or changing conditions without
requiring manual updates to predefined rules.
(b) Handles Complex Data: It can process and learn from large amounts of complex and
unstructured data, such as images, text, and audio.
(c) Improves Over Time: With more data, the model continues to learn and improve its
accuracy and efficiency.
(d) Generalization: Learning-based models can generalize to new, unseen data by learning from
diverse examples during training.
(e) Enhanced Accuracy: By learning from data, these models often provide more precise and
reliable results, especially in pattern recognition and predictive tasks.
Disadvantages of Learning based approach are as follows:
(a) Interpretability: Some learning-based models, especially deep learning models, can be
challenging to interpret and understand due to their complex internal representations.
(b) Large Data Requirements: Learning-based models typically require a large amount of labeled
data for training, which may not always be available or require significant effort for labeling.
(c) Overfitting: Learning-based models can be prone to overfitting if the training data is
insufficient or unrepresentative of the true underlying distribution, resulting in poor
generalization to new data.
(d) Lack of Transparency: Many learning-based models, especially deep learning, act as "black
boxes," making it hard to understand how they make decisions.
(e) Risk of Bias: If the training data contains biases, the model may learn and reinforce them,
leading to unfair or inaccurate outcomes.
(f) Slow Learning Process: Unlike rule-based systems that work instantly, learning-based
models take time to train and fine-tune before they provide reliable results.
(g) Difficult to Update: Updating or retraining models with new data can be complex and
require significant resources, unlike simple rule modifications in rule-based systems.

2.

Classification Algorithm Regression Algorithm


Classification algorithms predict a category or Regression algorithms predict a continuous
class label for the given input data. numeric value for the given input data.
It is used when the output variable is discrete, It is used when the output variable is continuous,
such as "yes/no" or "spam/ham". such as price, temperature, or salary.
Examples include email spam detection, disease Examples include predicting house prices, stock
diagnosis, and image recognition. values, or rainfall amounts.
The model assigns input data to one of the The model estimates a numerical value based on
predefined classes. input features.

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

Answer the following questions.

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.

Exercise Time Pg. 192


Fill in the blanks.

1. Single
2. Splitting
3. Train-test split
4. training set and testing set
5. training

Exercise Time Pg. 197


Fill in the blanks.

1. Accuracy
2. High-quality data
3. Hyperparameters
4. Bias
5. Error
6. 0 and 1

Answer the following questions.

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.

Exercise Time Pg. 203


Fill in the blanks.

1. Classification
2. Precision
3. False
4. F1 score
5. prediction and reality

Answer the following questions.

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)

Assessment Time Pg. 205


Fill in the blanks.

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

Short Answer Questions

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.

Long Answer Questions

1. Important Terminologies of Confusion Matrix are -


(a) True Positive (TP): The model correctly predicts a positive outcome. For e.g., predicting a
spam email as spam.
(b) True Negative (TN): The model correctly predicts a negative outcome. For e.g., predicting a
normal email as not spam.
(c) False Positive (FP): The model incorrectly predicts a positive outcome when it is actually
negative. For .g., predicting a normal email as spam.
(d) False Negative (FN): The model incorrectly predicts a negative outcome when it is actually
positive. For e.g., predicting a spam email as not spam.

2. Ethical concerns about model evaluation are –


(a) Bias - AI bias is a phenomenon that happens when a machine learning algorithm generates
results that are systematically prejudiced as a result of erroneous assumptions. . AI models
can inherit biases from the data they are trained on. If the training data is unbalanced or
reflects historical inequalities, the model may produce unfair predictions.
(b) Transparency: AI systems should be transparent, and their decision-making processes
should be explainable to users and stakeholders. Lack of transparency happens when AI
models are seen as "black boxes," meaning their decision-making processes are unclear. This
makes it hard for users or stakeholders to trust the model’s outputs.
(c) Accuracy: While high accuracy is often the goal, it can be misleading. A model may show
high accuracy but still perform poorly for smaller, underrepresented groups. Relying solely
on accuracy without considering other metrics like precision, recall, and F1 score can give a
false sense of reliability.

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

Tick the correct choice.

1. (b) No code
2. (c) Highly expensive
3. (a) High code

Answer the following questions.

1. Azure machine learning, Google cloud AutoML, Orange data mining.


2. No-Code AI offers a hassle-free way to implement artificial intelligence without the need for
coding, eliminating the risk of code-related errors. . It helps businesses save costs, as developing
fully coded AI systems can be expensive. With No-Code AI, companies can adopt AI solutions
easily and without the stress of hiring specialized AI staff.
3. The limitations of no-code AI tools are-
(a) Limited customization compared to traditional coding.
(b) May not handle very complex or large-scale AI projects.
(c) Dependence on platform features; cannot add unsupported functionality.
(d) Less control over model performance and optimization.
(e) Potential data security and privacy concerns.

Assessment Time Pg. 236


Fill in the blanks.

1. No-code tools
2. Lobe
3. Feature selection
4. Tree viewer
5. Confusion Matrix

Tick the correct choice.

1. True
2. False
3. True
4. True
5. False

Short Answer Questions

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:

No-Code Low-Code High-Code


No programming skills needed Basic programming knowledge Advanced programming skills
needed needed
Visual, drag-and-drop tools Visual with some coding options Fully text-based coding
Beginners, non-technical users Developers, tech-savvy users Experienced developers
Limited flexibility Moderate flexibility Highly customizable
Fast and easy Moderate setup time Time-consuming, requires setup
Simple AI models and Moderate AI solutions Complex AI models and systems
automation

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.

Long Answer Questions

1. The disadvantages of no-code AI tool are as follows:


(a) Lack of Flexibility – The users are restricted to the predefined elements provided by the
platform. This reduces your ability to fully customize your application, meaning no-code
platforms don’t offer the complete control and flexibility you might require.
(b) Automation Bias - Using no-code tools users may over-rely on automated processes without
fully understanding how AI models work. It reduces critical thinking, as users might accept AI
decisions without proper validation.
(c) Security Issues - No-code platforms usually do not prioritize security or encourage users to
follow best security practices. As a result, they often provide limited control over security
measures making systems vulnerable to breaches.
2. Key Features of No-Code AI:
(a) Visual Interface: Users can build models using drag-and-drop components.
(b) Code-Free: No programming knowledge is required to create AI solutions.
(c) Prebuilt Templates and Models: Ready-to-use AI models speed up development.
(d) Quick Deployment: AI applications can be deployed faster compared to traditional coding.
(e) Integration Support: Easily connects with databases, APIs, and other tools.
(f) User-Friendly: Designed for non-technical users to create and test AI models.

3.

(a) Import and Explore the Data

(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.

(b) Apply Clustering Algorithms to Segment Customers

(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.

(c) Evaluate the Quality of the Clusters

(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.

(d) Visualize the Clusters for Business Insights

(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. machine learning and deep learning


2. Tesla
3. Filters
4. Pixel
5. Grayscale

State whether true or false.

1. True
2. False
3. True
4. True

Short Answer Questions

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.

Long Answer Questions.

1. The typical architecture of a neural network consists of three types of layers:


(a) Input Layer: The first layer of the network that receives the raw input data. Each neuron in
the input layer represents a feature or attribute of the data.
(b) Hidden Layers: Layers between the input and output layers. These layers contain one or
more neurons, and they are responsible for learning and extracting relevant patterns and
features from the input data.
(c) Output Layer: The final layer of the network that produces the desired output or prediction.
The number of neurons in the output layer depends on the nature of the task.
2. The most common computer vision tasks that are frequently performed in AI terminology are as
follows:
(a) Image classification - It involves labelling or tagging a full picture based on training data from
previously labelled images.
(b) Image classification and localization - In this task, the goal is to not only identify the main
object's class or category within an image but also precisely localize its position using a
bounding box.
(c) Object detection - Object detection in computer vision is a fundamental task that involves
identifying and localizing multiple objects of interest within an image or a video.
(d) Image segmentation - Image segmentation or instance segmentation is a process of dividing
an image into fragments and assigning a label to each of those.
3. A kernel, also known as a filter, is a small matrix used for feature extraction from an input data
matrix, such as an image or a 2D signal. The kernel defines the operation to be performed during
the convolution process. It acts as a window that slides over the input data, extracting local
patterns or features at each position.

Role of kernel in Image Processing:

(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. Difference between human language and computer language is as follows:

Human Language Computer Language


Used by humans to communicate ideas, Used to give instructions to computers.
emotions, and information.
Ambiguous and flexible; meaning can change Precise and unambiguous; must follow strict
based on context. syntax.
Evolved naturally over time and varies across Designed artificially for programming and
regions and cultures. consistent interpretation.
Examples: English, Hindi, Spanish. Examples: Python, C++, Java.
2. Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) and linguistics that
deals with the interaction between computers and human language. It focuses on the ability of
machines to understand, interpret, and generate human language in a way that is both
meaningful and useful.
3. Natural Language Processing (NLP) is important because it bridges the gap between human
language and computer understanding. It enables computers to understand, interpret, and
respond to human language in a natural way. NLP allows machines to grasp the intent and
context of words, making interactions with systems like virtual assistants more intuitive,
accurate, and effective.

Exercise Time Pg. 274


Fill in the blanks.

1. Semantic
2. Grammatical
3. Semantic
4. Coreference, discourse
5. Pragmatic

Answer the following questions.

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

Answer the following questions.

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:

Script Bot Smart Bot


Works on predefined rules and scripts. Uses Artificial Intelligence (AI) and Machine
Learning (ML).
Can only respond to specific, pre-programmed Understands user intent and gives human-like
questions. responses.
Cannot learn or improve over time. Learns and improves through interaction and
data.
Example: Basic customer service chat with fixed Example: Virtual assistants like Siri, Alexa, or
replies. Google Assistant.

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.

Exercise Time Pg. 283


Answer the following questions.
1. Tokenization is the process of breaking text into smaller units called tokens, such as words,
phrases, or sentences, for easier analysis in Natural Language Processing (NLP).
2. Stop word removal is important because it removes common, uninformative words (like “is,”
“the,” “and”) from text, which helps:
(a) Reduce noise in the data.
(b) Improve processing efficiency by focusing on meaningful words.
(c) Enhance model accuracy in tasks like text classification, sentiment analysis, or information
retrieval.
3. Stemming is a simple text normalization technique that chops off the suffixes or prefixes of
words to obtain their root form, known as the "stem." The stem may not always be a valid word.
The purpose of stemming is to reduce words to a common base form, which allows words with
the same stem to be treated as identical.
Lemmatization, on the other hand, aims to reduce words to their base or dictionary form,
known as the "lemma." The lemma is a valid word present in the language's dictionary. The
purpose of lemmatization is to ensure that words with the same meaning are reduced to a
common base form, facilitating accurate semantic analysis.
4. Text Normalization is the process of converting text into a standard, uniform format to make it
easier for Natural Language Processing (NLP) tasks. It involves steps like - Converting all text to
lowercase, removing punctuation and special characters, expanding contractions (e.g., “isn’t” →
“is not”), Stemming or lemmatization to reduce words to their base form, etc.
5. The Bag of Words (BoW) is a commonly used technique in Natural Language Processing (NLP) for
representing text data as numerical vectors. The Bag of Words algorithm is used to extract two
main features of text in corpus – vocabulary and frequency. This approach focuses on the
frequency of words in a document and disregards the order or structure of the sentences.

Assessment Time Pg. 289


Fill in the blanks.

1. Inverse Document Frequency (IDF)


2. Stop words
3. Disclosure
4. Script bots
5. Text normalization

State whether true or false.

1. True
2. False
3. True
4. True
5. True

Short answer questions.


1. Defines
(a) Chatbot - A chatbot is an AI-based program that can simulate human conversation through
text or voice interactions. It is designed to understand user queries and respond
automatically, often used in customer service, education, banking, and online shopping to
provide instant support and information.
(b) Stopwords - Stopwords are common words in a language, such as “is,” “the,” “and,” “of,”
that do not add significant meaning to a sentence. In text processing, they are usually
removed to focus on more meaningful words and improve the efficiency of NLP tasks.
(c) Semantic Analysis - Semantic analysis is the process in Natural Language Processing (NLP) of
understanding the meaning and relationships of words and sentences in a text. It helps
computers grasp the context, intent, and logical meaning behind human language rather
than just the literal words.

2. Difference between extractive and abstractive sumarisation is –

Extractive Summarisation Abstractive Summarisation


Selects key sentences or phrases directly Generates new sentences that convey the
from the original text. main idea of the text.
Uses existing words and structure from the Uses its own words to rephrase and shorten
document. the content.
Easier to implement and more accurate in More complex as it requires understanding
preserving original meaning. and rewording the text.
Example: Picking important lines from a news Example: Writing a short summary of a news
article. article in new words.

3. The two applications areas of NLP are –


(a) Language Translation - Tools like Google Translate uses NLP to understand the meaning of
words and sentences in one language and turn them into another language.
(b) Virtual Assistants - Virtual assistants or voice assistants are applications that use natural
language processing (NLP) techniques to interact with users and perform tasks through
conversation or voice commands.

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.

Long Answer Questions.

1. Some examples of automatic text summarization are as follows –


(a) News summarization: Summarizing news articles to provide a quick overview of the main
events, without having to read the entire article.
(b) Document summarization: Summarizing long documents, such as research papers or legal
documents, to make it easier to understand the main ideas and findings.
(c) Email summarization: Summarizing long emails to quickly understand the main points and
take action accordingly.
(d) Social media summarization: Summarizing social media posts to quickly understand the
main ideas and sentiments, without having to read all the comments.
(e) Customer feedback summarization: Summarizing customer feedback to quickly understand
the main issues and concerns, and take action accordingly.
2. NLP involves five phases or steps that help process and analyze human language. These are as
follows:
(a) Lexical analysis - This phase involves understanding the structure of words in the text. It is
the process of breaking down a text file into paragraphs, phrases, and words.

(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:

1. Check whether input number is prime or not.

Step 1: Start

Step 2: Input a number n

Step 3: Initialize a variable count = 0

Step 4: For each number i from 1 to n perform step 5 and then


go to step 6

Step 5: If n % i == 0, increment count by 1

Step 6: If count == 2, print “Prime Number” else, print “Not


Prime”

Step 7: Stop

2. Display all even numbers between 50 and 100.

Step 1: Start

Step 2: Set a variable num = 50

Step 3: Repeat steps 4 to 6 while num <= 100

Step 4: If num % 2 = 0 (i.e., divisible by 2)

Step 5: Display num

Step 6: Increment num by 1

Step 7: Stop

3. Find the sum of first 20 odd numbers.


Step 1: Start

Step 2: Initialize sum = 0

Step 3: Initialize count = 1

Step 4: Initialize num = 1

Step 5: Repeat steps 6 to 8 while count <= 20

Step 6: Add num to sum (sum = sum + num)

Step 7: Increment num by 2 (num = num + 2)

Step 8: Increment count by 1 (count = count + 1)

Step 9: Display sum

Step 10: Stop

4. Find the HCF and LCM of two numbers.

Step 1: Start

Step 2: Initialize hcf = 0, lcm = 0, i =1

Step 3: Input num1 and num2

Step 4: Repeat steps 5 to 6 while i <= num1

Step 5: if num1 % i == 0 and num2 % i == 0 then


set hcf = i

Step 6: Increment i by 1 (i = i +1)

Step 7: Display hcf

Step 8: Find lcm = (num1 * num2)/ hcf

Step 9: Display lcm

Step 10: Stop

Exercise Time Pg. 315

Fill in the blanks.

1. Script
2. identifier
3. complex
4. type casting
5. print()

Answer the following questions.

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.

2. Three applications of Python are –


(a) Web Development: Python provides several frameworks like Django, Flask, and Pyramid
that simplifies the process of web development.
(b) Data Analysis and Visualization: Python enables data scientists and analysts to explore and
extract insights from large datasets, perform statistical analysis, and create visualizations.
(c) Machine Learning and Artificial Intelligence: Python has become a popular choice for
machine learning and AI development. Libraries like TensorFlow, PyTorch, scikit-learn, and
Keras provide powerful tools for developing and training machine learning models, natural
language processing, computer vision, and deep learning.

3. There are two types of comments in Python:


a. Single-line Comments: Single-line comments start with the # symbol and continue until the
end of the line.
b. Multi-line Comments: Multi-line comments can be given using triple-quotes (''' or """). The
text enclosed within the triple quotes is ignored by the complier.
4. Following are the main ways to create variables in Python:
a. Direct Assignment - The simplest method to create a variable is by directly assigning a value
to it using the assignment operator (=). In this method variables are created and values are
directly assigned to it in a single step as follows:

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.

Exercise Time Pg. 325

Answer the following questions.

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.

4. A virtual environment is a feature of Anaconda that creates an isolated environment that


allows you to have separate Python installations and package dependencies for different
projects. It creates a self-contained directory structure that contains its own Python interpreter
and packages, independent of the system-wide Python installation.

5. The command to create virtual environment is –


python -m venv myenv
Here, myenv is the name of your virtual environment.

To install Python kernel the command is –

pip install jupyter ipykernel


Exercise Time Pg. 333

Answer the following questions.

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 -

fruits = ["apple", "banana", "mango"]

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 -

colors = ("red", "green", "blue")

2. In Python, you can create list by placing all the items (elements) inside square bracket [] separated
by commas. For e.g.,

name = [“Amit”, “Sumit”, “Riya”]

A list can also have another list as an item. This is called nested lists. For e.g.,

nested_list = [[1, 2, 3], ["apple", "banana"], [10.5, 20.5]]

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.

Exercise Time Pg. 338


Answer the following questions.
1. In Python the if-else-if construct is rather called if-elif-else and is used to check more complex
conditions. It can execute different blocks of code based on multiple conditions.

For e.g.,

marks = 75

if marks >= 90:

print("Grade: A")

elif marks >= 75:

print("Grade: B")

elif marks >= 60:

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.

for num in range(1000, 1201):


if num % 9 == 0 and num % 7 == 0:
print(num)
4. Write a program to print prime numbers between 200 and 300.

Ans.
for num in range(200, 301):

count = 0

for i in range(1, num + 1):

if num % i == 0:

count += 1

if count == 2: # Prime numbers have exactly 2 factors: 1 and itself

print(num)

5. Write a program to input two numbers` and print their HCF and LCM.

Ans.

# Program to find HCF and LCM using factorization method

# Input two numbers

num1 = int(input("Enter first number: "))

num2 = int(input("Enter second number: "))

# Find HCF

hcf = 1

for i in range(1, min(num1, num2) + 1):

if num1 % i == 0 and num2 % i == 0:

hcf = i

# Find LCM using the formula: LCM = (num1 * num2) / HCF

lcm = (num1 * num2) // hcf

print("HCF of", num1, "and", num2, "is:", hcf)

print("LCM of", num1, "and", num2, "is:", lcm)

Assessment Time Pg. 342


Fill in the blanks.

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

Short Answer Questions

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.

2. Difference between a list and tuple is –

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.,

age = int(input("Enter your age: "))


Long Answer Questions.

1. Some features of Python that make it popular for AI development:


(a) Simple and Easy to Learn: Python has a clean and readable syntax, which makes it easy for
beginners and developers to write and understand AI programs.
(b) Extensive Libraries: Python has many libraries for AI and machine learning, such as
TensorFlow, Keras, PyTorch, NumPy, Pandas, and Scikit-learn, which simplify coding and
reduce development time.
(c) Open Source: Python is free and open-source, which allows developers to use, modify, and
share it without cost.
(d) Platform Independent: Python can run on multiple operating systems like Windows, Linux,
and macOS without changes in code.
(e) Community Support: Python has a large and active community that provides support,
tutorials, and pre-built modules for AI applications.
(f) Integration Capabilities: Python can easily integrate with other languages, tools, and
technologies, making it suitable for complex AI systems.
(g) Flexibility: Python supports multiple programming paradigms, such as object-oriented,
procedural, and functional programming, which is useful for AI projects.

2. In Python data types can be categorized as follows –


(a) Numeric Types: These data types are used to create numeric variables. These variables can
be integer, float and complex.
(b) Boolean: Boolean values are logical values. It only has two built-in values: true and false,
which provide the results 1 and 0, respectively.
(c) Sequence: In Python, sequence data types are used to represent an ordered collection of
elements. These data types allow you to store and manipulate multiple values in a specific
order.
(d) Mapping: These are unordered data types used for mapping keys with its corresponding
value. It includes Dictionary
(e) Sets: A Set is an unordered collection of values of any data type. It is mutable, i.e. it can be
modify after creation. Set has unique elements. The order of the elements is undefined and
set may return the changed sequence of the element.

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.

Application based questions.

1. Write a Python code to input a number and check whether the number is divisible by 11 or not.

Code:

# Input a number from the user

num = int(input("Enter a number: "))

# Check divisibility by 11

if num % 11 == 0:

print(num, "is divisible by 11")

else:

print(num, "is not divisible by 11")

2. Write a Python program to print a table of a given number.

Code:

# Input a number from the user


num = int(input("Enter a number: "))

Print the multiplication table

print("Multiplication table of", num)

for i in range(1, 11):

print(num, "x", i, "=", num * i)

3. Write a Python program to print the cubes of first 10 natural numbers.

Code:

# Print cubes of first 10 natural numbers

print("Cubes of first 10 natural numbers:")

for i in range(1, 11):

cube = i ** 3

print("Cube of", i, "is", cube)

4. Write a Python program to print all prime numbers between 100 and 200.

Code:

print("Prime numbers between 100 and 200:")

for num in range(100, 201):

count = 0

for i in range(1, num + 1):

if num % i == 0:

count += 1

if count == 2: # Prime numbers have exactly 2 factors: 1 and itself

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:

# Input student name


name = input("Enter student name (or press Enter to stop): ")

if name == "": # Stop if blank name is entered

print("Program ended.")

break

# Input marks in 5 subjects

marks = []

for i in range(1, 6):

mark = float(input(f"Enter marks for subject {i}: "))

[Link](mark)

# Calculate total and percentage

total = sum(marks)

percentage = (total / 500) * 100

# Display results

print(f"Total marks of {name}:", total)

print(f"Percentage of {name}:", percentage, "%\n")

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:

# Input the shopping bill amount

amount = float(input("Enter the amount of shopping bill: "))

# Check the conditions and print the gift

if amount < 2500:

print("No gift")

elif (amount >= 2500 and amount <= 5000):


print("Gift: A shopping bag")

else: # amount > 5000

print("Gift: A pen drive")

Common questions

Powered by AI

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 .

You might also like