Class 10 Computer Science · Chapter 6
Introduction to Artificial Intelligence (AI) and Machine Learning (ML): questions and answers
Every short question, long question and MCQ on this chapter's free papers, each with its answer. Try one yourself first, then check.
Short questions with answers
Q1 · 2 marks
What is Artificial Intelligence (AI)? Define it.
Answer
AI means teaching machines to do tasks that usually require human intelligence such as understanding speech, recognizing images or making decisions. AI is the ability of a machine or computer program to perform tasks that normally require human thinking and ability.
Q2 · 3 marks
What is the difference between AI and ML?
Answer
AI is making machines smart enough to mimic human behavior, with the goal of performing smart tasks like humans; it sometimes uses data. ML is teaching machines to learn from data and improve, with the goal of making predictions or decisions from data; it always needs data and just learns patterns. AI is the broader concept and ML is a part of AI.
Q3 · 2 marks
Give one real-life example of AI used in Pakistan.
Answer
Chatbots used by banks like HBL and JazzCash for customer support. (Other examples: Urdu speech-to-text apps used in schools and the traffic control system introduced by Safe City Authority in Lahore.)
Q4 · 3 marks
Give three real-life examples of AI.
Answer
1)Urdu speech-to-text apps used in educational institutes including schools.
2)Chatbots used by banks like HBL and JazzCash for customer support.
3)Traffic control systems in big cities such as the one introduced by Safe City Authority in Lahore.
Q5 · 2 marks
What is Machine Learning (ML)? Define it.
Answer
Machine Learning is a part of AI. It means training a machine to learn from data and make decisions on its own without being programmed every time. ML is a method where computers learn from past data to predict or decide something.
Q6 · 2 marks
Give two examples of Machine Learning.
Answer
1)Netflix or YouTube recommend videos based on the watching history of users.
2)A weather app uses past temperatures to predict the weather for the next day.
Q7 · 2 marks
How is ML related to AI?
Answer
Machine Learning is a part of AI. AI is the broader concept of machines acting smart, while ML is when machines learn from data to make predictions or decisions.
Q8 · 2 marks
Why are AI and ML needed in the modern world?
Answer
Huge amounts of data are being collected every second, more than humans can handle alone. AI and ML learn from data and help machines think, decide and improve (just like humans) but faster and more consistently.
Q9 · 3 marks
Compare AI and ML on the basis of main goal and need of data.
Answer
Main goal: AI performs smart tasks like humans, while ML makes predictions or decisions from data.
Needs data: AI sometimes (uses data to act smartly), while ML always (needs data to learn).
Q10 · 2 marks
What do the Tidbits say about the relationship between AI and ML?
Answer
Think of AI as the brain and ML as the experience that teaches the brain how to improve. AI is the broader concept of machines acting smart, while ML is when machines learn from data to make predictions or decisions.
Q11 · 2 marks
In which two main ways can machines learn?
Answer
Just like students can learn with the help of a teacher or by exploring on their own, machines can learn in two main ways: Supervised Learning and Unsupervised Learning.
Q12 · 2 marks
What is supervised learning?
Answer
Supervised learning is when the machine is trained using labeled data, where both instance and correct output are provided.
Q13 · 3 marks
How does supervised learning work?
Answer
In supervised learning, the machine is given data with correct answers (labels). It learns by comparing its own guesses with the correct answers and its learning improves over time. For example, a machine shown many labeled apples and mangoes can later predict with high accuracy whether a new picture is an apple or a mango.
Q14 · 2 marks
What are labels in supervised learning? Give an example.
Answer
Labels are the correct answers given with the data.
Example: showing a machine many fruits labeled "This is an Apple" and "This is a Mango".
Q15 · 3 marks
Explain the apple and mango example of supervised learning.
Answer
We train a machine to predict whether a fruit is an apple or a mango. We show it many apples and mangoes and label each as "This is an Apple" or "This is a Mango". The computer learns from these examples and can later predict with high accuracy when shown a new picture.
Q16 · 2 marks
Give an example of supervised learning in school.
Answer
A system can be trained based on marks and attendance of students to predict who might fail. It can also identify students who need help.
Q17 · 2 marks
What is unsupervised learning?
Answer
Unsupervised learning is when the machine finds patterns or groups in unlabeled data without being told what the correct answer is.
Q18 · 2 marks
What kind of data is used in unsupervised learning?
Answer
Unlabeled data. The machine is given only data without any labels and has to find patterns or group similar things by itself.
Q19 · 2 marks
Give an example of unsupervised learning.
Answer
A school wants to divide students into study groups. The system checks their interests and subjects and forms groups just based on similarities without knowing which group is "best". Another example is grouping customers based on shopping behavior.
Q20 · 3 marks
Explain how unsupervised learning helps a school form study groups.
Answer
The system is given students' interests and subjects without labels. It checks the similarities between them and forms groups automatically, without knowing in advance which group is "best".
Q21 · 3 marks
What is the main task of supervised learning and unsupervised learning?
Answer
Supervised learning uses labeled data (the machine is told the correct answers) and its main task is to predict or classify. Unsupervised learning has no labeled data (the machine finds patterns on its own) and its main task is to group or cluster similar data.
Q22 · 4 marks
Write whether each situation is supervised (S) or unsupervised (U) learning with a brief reason:(1) Predicting if a student will pass or fail (2) Grouping students based on subject preferences (3) Identifying spam emails from inbox (4) Dividing products into types based on features.
Answer
(1)S: the system learns from past results with correct answers (pass or fail).
(2)U: students are grouped by similarity without labels.
(3)S: emails are labeled as spam or not spam.
(4)U: products are divided into types by features without given answers.
Q23 · 2 marks
How can you tell whether a system is supervised or unsupervised?
Answer
If the system is learning from examples with correct answers, it is supervised. If it is grouping without given answers, it is unsupervised. Think of supervised learning as learning with a teacher and unsupervised learning as exploring on your own.
Q24 · 2 marks
Where are supervised and unsupervised learning used in Pakistan?
Answer
Both are used in schools, businesses, apps and government systems in Pakistan.
Q25 · 2 marks
What are smart assistants? Give examples.
Answer
Smart assistants like Google Assistant and Siri use AI to understand voice commands, translate languages, set reminders and answer questions.
Q26 · 2 marks
Give one example each of a smart assistant and a recommendation system.
Answer
Smart assistant: Google Assistant (or Siri).
Recommendation system: YouTube recommending videos after you watch a few clips (or Daraz suggesting clothes based on browsing history).
Q27 · 3 marks
How does Google Assistant set an alarm when you say "Kal 8 bajay mujhe jagana"?
Answer
It sets an alarm using speech recognition and natural language processing techniques, both powered by AI. It understands the Urdu voice command and performs the task.
Q28 · 3 marks
What are recommendation systems? Give examples.
Answer
Recommendation systems suggest what you might like based on your past activities.
Examples: YouTube recommends videos after you watch a few clips; Daraz suggests clothes based on your browsing history; Instagram shows videos similar to what you have watched before.
Q29 · 2 marks
How do recommendation apps improve their suggestions over time?
Answer
These apps use ML to analyze what you like and improve their suggestions over time.
Q30 · 3 marks
List three apps you have used that may use AI and write the role of AI in each.
Answer
YouTube: AI suggests videos you might like.
Google Maps: AI helps you search and find routes faster.
ChatGPT: AI answers questions. Snapchat or Google Assistant: AI responds to voice commands or suggestions. (Any three correct apps with the AI role are acceptable.)
Q31 · 3 marks
What is customer analysis? Give an example.
Answer
Companies collect data about customers to find which product is best to sell.
Example: a grocery delivery app like Cheetay uses ML to suggest items you often buy and predicts which items are needed in which city.
Q32 · 3 marks
How can businesses use AI?
Answer
AI helps businesses understand customers, answer questions and improve their services. Businesses use customer analysis (e.g. which product is best to sell) and chatbots to answer customer questions without a human agent. AI helps them work faster, save money and keep customers happy using the power of data.
Q33 · 3 marks
What are chatbots? How do they help businesses?
Answer
Chatbots are smart systems used by many Pakistani banks, telecoms and e-commerce sites. They use AI to understand typed questions and respond automatically, answering questions without needing a human agent.
Q34 · 2 marks
How does AI help businesses according to the Do You Know note?
Answer
AI helps businesses work faster, save money and keep customers happy using the power of data.
Q35 · 2 marks
What is bias in AI? Give an example.
Answer
Sometimes machines learn unfair patterns from the data they are trained on. This is called bias. For example, if an AI system is trained only on English or male voices, it may not work well with Urdu speakers or female voices.
Q36 · 2 marks
How can bias in AI be reduced?
Answer
By always using diverse and balanced data.
Q37 · 3 marks
What privacy concerns arise when AI systems use data?
Answer
AI systems often use personal data (like name, location or choices), which raises privacy concerns. For example, if an app tracks your movements or listens to your microphone without permission, it can be misused.
Q38 · 3 marks
List three best practices for protecting privacy in AI systems.
Answer
1)Ask for user permission.
2)Protect data using encryption.
3)Do not collect more than needed.
Q39 · 3 marks
Who is responsible if an AI system makes a wrong decision?
Answer
Humans must use AI wisely as it is just a tool. If an AI-powered system makes a wrong decision, the responsibility lies with the humans who created or used it. For example, a facial recognition system that wrongly accuses someone should be fixed.
Q40 · 2 marks
What is an algorithm? Explain using the recipe analogy.
Answer
An algorithm is like a recipe in the kitchen. It tells the computer what ingredients (data) to use and what steps to follow to get the final dish (prediction or group).
Q41 · 3 marks
Name three common data science algorithms with one use of each.
Answer
1)Linear Regression: predicts future values based on a straight-line relationship (e.g. predicting student scores from study hours).
2)Decision Trees: use a tree-like model to make decisions based on yes/no questions (e.g. predicting if a customer will buy or not).
3)K-Means (Clustering): groups similar items together (e.g. grouping students with similar interests).
Q42 · 3 marks
What is simple linear regression? Give an example.
Answer
Simple Linear Regression helps us predict a value based on the relationship between two things.
Example: a teacher predicts how well students will perform in a test based on the hours they studied. Study hours is the Input (X) and test score is the Output (Y). The algorithm finds a line that best fits the data.
Q43 · 3 marks
In the study hours example (Table 6.5), identify the input and output and find the score for a student who studied 7 hours.
Answer
Input (X) is study hours and Output (Y) is test score. From Table 6.5, a student who studied 7 hours scores 65.
Q44 · 3 marks
What is the difference between simple linear regression and multiple linear regression?
Answer
Simple linear regression uses just one independent variable (input) to predict one outcome. In real life outcomes usually depend on many things, so multiple linear regression is used to help the computer understand more complex patterns and improve prediction accuracy.
Q45 · 2 marks
Define confusion matrix.
Answer
A confusion matrix is a simple table that shows how many predictions or classifications were correct or incorrect. It helps in understanding whether a model is making mistakes and in calculating accuracy.
Q46 · 4 marks
Define TP, TN, FP and FN in a pass/fail model.
Answer
TP (True Positive): the model predicted pass and the student passed in actual.
TN (True Negative): the model predicted fail and the student failed in actual.
FP (False Positive): the model predicted pass but the student failed in actual.
FN (False Negative): the model predicted fail and the student passed in actual.
Q47 · 2 marks
What is accuracy? Write its formula.
Answer
Accuracy (A) tells us how many predictions were correct out of all predictions made. Accuracy = (TP + TN) / (TP + TN + FP + FN).
Q48 · 3 marks
Calculate the accuracy of a model with TP = 7, TN = 5, FP = 2 and FN = 1.
Answer
A = (7 + 5) / (7 + 5 + 2 + 1) = 12 / 15 = 0.80 or 80%.
Q49 · 3 marks
Calculate the accuracy of a model with TP = 40, TN = 45, FP = 10 and FN = 5.
Answer
A = (40 + 45) / (40 + 45 + 10 + 5) = 85 / 100 = 0.85 or 85%.
Long questions with answers
Q1 · 8 marks
Explain supervised and unsupervised learning with suitable examples.
Answer
Machines can learn in two main ways, just like students learn with a teacher or by exploring on their own.
1.Supervised Learning
- The machine is given data with correct answers (labels). It learns by comparing its own guesses with the correct answers and its learning improves over time.
- Definition: supervised learning is when the machine is trained using labeled data, where both instance and correct output are provided.
- Example 1: to predict whether a fruit is an apple or a mango, we show the machine many apples and mangoes labeled "This is an Apple" and "This is a Mango". Later it can predict with high accuracy when shown a new picture.
- Example 2: a system trained on marks and attendance of students predicts who might fail.
- Main task: predict or classify.
Use in school: identify students who need help.
2.Unsupervised Learning
- The machine is given only data without any labels. It has to find patterns or group similar things by itself.
- Definition: unsupervised learning is when the machine finds patterns or groups in unlabeled data without being told what the correct answer is.
- Example: a school wants to divide students into study groups. The system checks interests and subjects and forms groups based on similarities without knowing which group is "best". Another example is grouping customers based on shopping behavior.
- Main task: group or cluster similar data.
Use in school: make automatic student groups for projects.
3.
Quick rule: if the system learns from examples with correct answers it is supervised; if it groups without given answers it is unsupervised. Supervised learning is like learning with a teacher and unsupervised learning is like exploring on your own.
Q2 · 8 marks
Explain how model performance is evaluated in machine learning using the following metrics: a) Confusion Matrix b) Accuracy c) Precision
Answer
Once an ML model is trained (like predicting who will buy a product or whether a message is spam) we measure its performance to decide if it is accurate and reliable.
a) Confusion Matrix
A confusion matrix is a simple table that shows how many predictions or classifications were correct or incorrect. For a pass/fail model:
Predicted: pass | Predicted: fail
Actual: pass TP | FN
Actual: fail FP | TN
TP: predicted pass and actually pass.
TN: predicted fail and actually fail.
FP: predicted pass but actually fail.
FN: predicted fail but actually pass. It shows what kind of mistakes the model makes and helps calculate accuracy.
b) Accuracy
Accuracy tells how many predictions were correct out of all predictions made. Accuracy = (TP + TN) / (TP + TN + FP + FN).
Example: 15 students with TP = 7, TN = 5, FP = 2, FN = 1: A = (7 + 5) / 15 = 12/15 = 0.80 or 80%.
c) Precision
Precision tells how many of the cases predicted as positive were actually positive. Precision = TP / (TP + FP). Using the same example: 7 / (7 + 2) = 7/9 = about 0.78 or 78%. A high precision means few false positives.
Together these metrics show whether the model is reliable.
Q3 · 6 marks
A model predicts if students will pass (1) or fail (0). Out of 20 students: True Positives (TP) = 8, True Negatives (TN) = 6, False Positives (FP) = 4, False Negatives (FN) = 2. You are required to (a) fill the confusion matrix, and (b) calculate accuracy.
Answer
(a)Confusion matrix
Predicted: pass (1) | Predicted: fail (0)
Actual: pass TP = 8 | FN = 2
Actual: fail FP = 4 | TN = 6
Check: 8 + 2 + 4 + 6 = 20 students.
(b)Accuracy
Accuracy = (TP + TN) / (TP + TN + FP + FN)
= (8 + 6) / (8 + 6 + 4 + 2)
= 14 / 20
= 0.70 or 70%.
The model made 14 correct predictions out of 20.
Q4 · 8 marks
Define Artificial Intelligence and Machine Learning, give examples of each and explain the differences between them.
Answer
Why AI and ML: huge amounts of data are collected every second, more than humans can handle alone. AI and ML learn from data and help machines think, decide and improve, faster and more consistently.
1.AI
AI means teaching machines to do tasks that usually require human intelligence such as understanding speech, recognizing images or making decisions.
Definition: AI is the ability of a machine or computer program to perform tasks that normally require human thinking and ability.
Examples: Urdu speech-to-text apps used in schools; chatbots used by banks like HBL and JazzCash; the traffic control system introduced by Safe City Authority in Lahore.
2.ML
ML is a part of AI. It means training a machine to learn from data and make decisions on its own without being programmed every time.
Definition: ML is a method where computers learn from past data to predict or decide something.
Examples: Netflix or YouTube recommend videos based on watching history; a weather app uses past temperatures to predict the weather for the next day.
3.Differences (Table 6.1)
- Definition: AI makes machines smart enough to mimic human behavior; ML teaches machines to learn from data and improve.
- Main goal: AI performs smart tasks like humans; ML makes predictions or decisions from data.
- Needs data: AI sometimes (uses data to act smartly); ML always (needs data to learn).
- Human-like behavior: AI yes (speaking, seeing, understanding); ML no (just learns patterns).
- Example: AI is a chatbot on JazzCash that replies to customers; ML is an app that predicts electricity usage next week.
Think of AI as the brain and ML as the experience that teaches the brain how to improve.
Q5 · 8 marks
Explain the practical applications of AI and ML in smart assistants, recommendation systems and business, with examples.
Answer
1.Smart assistants
Smart assistants like Google Assistant and Siri use AI to understand voice commands, translate languages, set reminders and answer questions.
Example: saying "Kal 8 bajay mujhe jagana" in Urdu makes Google Assistant set an alarm using speech recognition and natural language processing, both powered by AI.
2.Recommendation systems
These suggest what you might like based on your past activities.
Examples: YouTube recommends videos after you watch a few clips; Daraz suggests clothes based on browsing history; Instagram shows videos similar to what you watched before. These apps use ML to analyze what you like and improve their suggestions over time.
3.Business use cases
- Customer analysis: companies collect data about customers to find which product is best to sell.
Example: a grocery delivery app like Cheetay uses ML to suggest items you often buy and predicts which items are needed in which city.
- Chatbots and automated help: many Pakistani banks, telecoms and e-commerce sites use chatbots, smart systems that use AI to understand typed questions and respond automatically without needing a human agent.
AI helps businesses work faster, save money and keep customers happy using the power of data.
Q6 · 8 marks
Discuss bias, privacy and responsibility when using AI.
Answer
While AI is powerful, it must be used responsibly.
1.Bias in AI
Sometimes machines learn unfair patterns from the data they are trained on. This is called bias.
Example: if an AI system is trained only on English or male voices, it may not work well with Urdu speakers or female voices.
Solution
always use diverse and balanced data
2.Privacy and data use
AI systems often use personal data (like name, location or choices), which raises privacy concerns. For example, if an app tracks your movements or listens to your microphone without permission, it can be misused.
Best practices: ask for user permission; protect data using encryption; do not collect more than needed.
3.Responsibility of humans
Humans must use AI wisely as it is just a tool. If an AI-powered system makes a wrong decision, the responsibility lies with the humans who created or used it. For example, if a facial recognition system wrongly accuses someone, the system should be fixed.
We must always consider ethics: fairness, privacy and responsibility.
Q7 · 8 marks
Explain simple linear regression using the study hours and test score example (Table 6.5). Predict the score for 6 and 6.5 hours of study.
Answer
1.Concept
Simple Linear Regression predicts a value based on the relationship between two things. A teacher wants to predict how well students will perform in a test based on study hours. Study hours is the Input (X) and test score is the Output (Y). Linear regression finds a straight line that best fits the data and uses it to predict future values.
2.Data (Table 6.5)
Study hours 1 to 10 give scores 35, 40, 45, 50, 55, 60, 65, 70, 75, 80. In the graph, the blue dots are actual student scores and the line shows the predicted trend.
3.Reading the line
Each extra hour adds 5 marks, so the line can be written as Score = 30 + 5 x Hours.
- For 6 hours: 30 + 5 x 6 = 60 (also given in Table 6.5).
- For 6.5 hours: 30 + 5 x 6.5 = 62.5.
4.Uses and limits
Linear regression is used for predicting sales, temperature or student performance from past data. Simple linear regression uses just one input, but real outcomes usually depend on many things, so multiple linear regression helps the computer understand more complex patterns and improve prediction accuracy.
Q8 · 6 marks
Describe the common data science algorithms: Linear Regression, Decision Trees and K-Means. How do we choose the right algorithm?
Answer
Data science uses algorithms to find patterns, make predictions or analyze large data. An algorithm is like a recipe: it tells the computer what ingredients (data) to use and what steps to follow to get the final dish (prediction or group).
1.
Linear Regression: predicts future values based on a straight-line relationship, e.g. predicting student scores from study hours.
2.
Decision Trees: use a tree-like model to make decisions based on yes/no questions, e.g. predicting if a customer will buy or not.
3.
K-Means (Clustering): groups similar items together, e.g. grouping students with similar interests.
Choosing the right algorithm: it depends on the type of data and the kind of problem. To predict a number, use Linear Regression; to make yes/no decisions, use Decision Trees; to group similar things without labels, use K-Means.
These algorithms help solve real-world problems such as predicting exam results, grouping customers for better marketing and identifying patterns in fraud or health data.
Q9 · 6 marks
A model predicts whether a message is spam. Out of 50 messages: TP = 20, TN = 18, FP = 5 and FN = 7. Draw the confusion matrix, explain each value and calculate accuracy.
Answer
Taking spam as the positive class:
Confusion matrix
Predicted: spam | Predicted: not spam
Actual: spam TP = 20 | FN = 7
Actual: not spam FP = 5 | TN = 18
Meaning of the values
- TP = 20: predicted spam and actually spam.
- TN = 18: predicted not spam and actually not spam.
- FP = 5: predicted spam but actually not spam.
- FN = 7: predicted not spam but actually spam.
Total = 20 + 18 + 5 + 7 = 50.
Accuracy = (TP + TN) / (TP + TN + FP + FN) = (20 + 18) / 50 = 38 / 50 = 0.76 or 76%.
The model made 38 correct predictions out of 50.
Q10 · 6 marks
Activity: Match the situations in Table 6.4 as supervised (S) or unsupervised (U) learning and justify each answer. Also compare both types of learning using Table 6.3.
Answer
Table 6.4 matching
1.Predicting if a student will pass or fail: S. Past data has known results (pass or fail) which are labels.
2.Grouping students based on subject preferences: U. No labels are given; students are grouped by similarity.
3.Identifying spam emails from inbox: S. Emails are labeled spam or not spam and the machine learns from the correct answers.
4.Dividing products into types based on features: U. The machine groups products by features without given answers.
Comparison (Table 6.3)
- Labeled data: supervised yes (machine is told the correct answers); unsupervised no (machine finds patterns on its own).
- Main task: supervised predicts or classifies; unsupervised groups or clusters similar data.
- Example: supervised predicts student results using marks and study hours; unsupervised groups customers based on shopping behavior.
- Use in school: supervised identifies students who need help; unsupervised makes automatic student groups for projects.
Supervised learning is like learning with a teacher, and unsupervised learning is like exploring on your own.
Test yourself on this chapter
Timed chapter tests, marked the moment you finish.
Practise with a free account
Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.