Test 6: Long Questions

Long questions

10 questions · 50 min · 72 marks

Want to try first? Take the free Computer Science test: 94hbp-7gz9m-ufent-tsj4r

Sample questions with answers

The first 5 of 10, each with a model answer. Try writing yours first.

  1. Question 1 · 8 marks

    Explain supervised and unsupervised learning with suitable examples.

    Show model 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.

  2. Question 2 · 8 marks

    Explain how model performance is evaluated in machine learning using the following metrics: a) Confusion Matrix b) Accuracy c) Precision

    Show model 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.

  3. Question 3 · 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.

    Show model 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.

  4. Question 4 · 8 marks

    Define Artificial Intelligence and Machine Learning, give examples of each and explain the differences between them.

    Show model 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.

  5. Question 5 · 8 marks

    Explain the practical applications of AI and ML in smart assistants, recommendation systems and business, with examples.

    Show model 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.

More tests in Introduction to Artificial Intelligence (AI) and Machine Learning (ML)

Practise with a free account

Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.

Create free account