AI and Emerging Tech: Machine Learning, Cloud, IoT and Blockchain
Recent computer papers increasingly include questions on artificial intelligence, cloud computing, the Internet of Things, blockchain and big data. The questions test the core ideas rather than particular products: how machine learning differs from AI, which kind of learning uses labelled data, which cloud model a service belongs to, and what links the blocks of a blockchain. This lesson builds those ideas from the ground up and avoids fast-changing product details.
Asked in: PPSC, FPSC, NTS, ETEA, KPPSC, SSC, IBPS and ICS/ECAT computer
AI, machine learning and deep learning
Artificial intelligence (AI) is the broad field of making computers perform tasks that normally need human intelligence, such as understanding language, recognising images, planning and making decisions. Early AI relied heavily on hand-written rules, as in expert systems that encode a specialist’s knowledge as if-then rules.
Machine learning (ML) is a branch of AI in which a system learns patterns from data instead of being given every rule by a programmer. A model is trained on example data, then used to make predictions on new data it has not seen.
Deep learning is a branch of machine learning that uses artificial neural networks with many layers. Each layer of artificial neurons transforms its input and passes it on, and the word deep refers to the number of hidden layers. Deep learning needs large amounts of data and computing power, often from GPUs, and drives modern image recognition, speech recognition and language models. So deep learning ⊂ machine learning ⊂ artificial intelligence.
- Deep learning ⊂ Machine learning ⊂ Artificial intelligence
- Expert system: rule-based AI built from human expertise
- Machine learning: learns patterns from data
- Deep learning: neural networks with many hidden layers
Types of machine learning
In supervised learning the training data is labelled: each example comes with the correct answer, such as emails marked spam or not spam. The model learns to map inputs to those answers. When the answer is a category, the task is classification; when it is a number, such as a house price or tomorrow’s temperature, the task is regression.
In unsupervised learning the data has no labels, and the model looks for structure on its own. Clustering groups similar items, such as dividing a shop’s customers into groups with similar buying habits; association finds items that often occur together, such as products bought in the same basket.
In reinforcement learning an agent learns by acting in an environment and receiving rewards or penalties, gradually choosing actions that earn more reward. It is used for game-playing programs and robot control.
- Supervised: labelled data → classification (category) or regression (number)
- Unsupervised: unlabelled data → clustering, association
- Reinforcement: trial and error with rewards and penalties
Training, testing and measuring a model
Data is usually split into a training set, used to fit the model, and a test set kept aside to check how well it works on unseen data; a 70 : 30 or 80 : 20 split is common. Accuracy = correct predictions ÷ total predictions.
Overfitting happens when a model learns the training data too closely, including its noise, so it scores very well on training data but poorly on new data. Underfitting is the opposite: the model is too simple to capture the pattern and does badly on both.
For tasks such as spam filtering, precision and recall give a fuller picture. Precision = true positives ÷ all items the model flagged as positive, telling you how many of its alarms were right. Recall = true positives ÷ all items that really were positive, telling you how many real cases it caught.
- Accuracy = correct ÷ total
- Precision = true positives ÷ predicted positives
- Recall = true positives ÷ actual positives
- Overfitting: great on training data, poor on new data
Applications of AI
Natural language processing (NLP) lets computers work with human language: translation, chatbots, voice assistants, summarising and sentiment analysis. Computer vision lets them interpret images and video: face recognition, reading number plates and spotting disease in medical scans.
Generative AI produces new content, such as text, images or audio, after learning patterns from very large data sets; large language models are the text-generating kind. Its output can sound confident yet be wrong, so it needs human checking.
Robotics combines AI with sensors and motors, and recommendation systems suggest videos, products or news based on past behaviour. AI systems can also inherit bias from the data they are trained on, which is why fairness and transparency are part of responsible AI.
- NLP: language (translation, chatbots, speech)
- Computer vision: images and video (face, number plate recognition)
- Generative AI: creates new text, images, audio
- Biased data → biased model
Cloud computing
Cloud computing delivers computing resources such as servers, storage, databases and software over the Internet on demand, usually paid for by use. Its key features are on-demand self-service, broad network access, shared resource pooling, rapid elasticity (scaling up or down quickly) and measured, pay-as-you-go service.
There are three main service models. In IaaS (Infrastructure as a Service) the provider rents out virtual machines, storage and networks, and the customer manages the operating system and applications. In PaaS (Platform as a Service) the provider also manages the operating system and runtime, so developers just upload and run their code. In SaaS (Software as a Service) complete applications are used through a browser or app, such as web-based email or online office suites, with nothing to install or maintain.
Deployment models describe who uses the cloud. A public cloud is shared by many customers of a provider; a private cloud serves one organisation; a hybrid cloud combines private and public clouds; and a community cloud is shared by organisations with common needs, such as government departments.
- IaaS: virtual machines, storage, networks (you manage OS and apps)
- PaaS: platform to deploy code (provider manages OS and runtime)
- SaaS: ready-to-use applications through a browser
- Public, private, hybrid, community clouds
- Elasticity: scale resources up or down on demand
IoT, blockchain, big data and other emerging ideas
The Internet of Things (IoT) is the network of everyday physical objects fitted with sensors, software and connectivity so that they can collect and exchange data, such as smart electricity meters, wearable fitness bands, smart home devices and soil-moisture sensors on farms. Edge computing processes such data close to where it is produced instead of sending everything to a distant data centre, reducing delay and bandwidth.
A blockchain is a distributed ledger: a record of transactions copied across many computers. Transactions are grouped into blocks, and each block stores the cryptographic hash of the previous block, which links them into a chain. Changing an old block would change its hash and break every link after it, so tampering is easy to detect; the participants agree on new blocks through a consensus mechanism. Cryptocurrencies such as Bitcoin are the best-known use, but blockchains are also used for supply-chain and land-record tracking.
Big data means data sets too large or fast for traditional tools, described by the Vs: volume (the amount), velocity (the speed at which it arrives), variety (structured, semi-structured and unstructured forms such as tables, text, images and video), and often veracity (trustworthiness) and value. Other emerging ideas include augmented reality (AR), which overlays digital content on the real world, virtual reality (VR), which replaces it with a fully computer-generated one, and quantum computing, which uses qubits that can be in a superposition of 0 and 1.
- IoT: connected sensors and devices; edge computing: process near the source
- Blockchain: distributed ledger; each block holds the previous block’s hash
- Big data Vs: volume, velocity, variety (+ veracity, value)
- AR overlays the real world; VR replaces it
- Qubit: superposition of 0 and 1
Solved examples
- Classify each task as supervised, unsupervised or reinforcement learning: (i) predicting whether a loan applicant will default using past loans marked defaulted or repaid; (ii) grouping mobile users by usage patterns without any labels; (iii) a program learning to play a game by winning or losing points.
- (i) The past loans carry the correct outcome, so this is supervised learning, and since the answer is a category it is classification.
- (ii) There are no labels and the goal is to form groups, so this is unsupervised learning (clustering).
- (iii) Learning from points won and lost is reinforcement learning.
Answer: (i) supervised, (ii) unsupervised, (iii) reinforcement - Which is classification and which is regression: predicting the price of a flat in Karachi, predicting whether an X-ray shows pneumonia, predicting tomorrow’s maximum temperature in Delhi?
- A flat’s price is a number on a continuous scale, so it is regression.
- Pneumonia or no pneumonia is a choice between categories, so it is classification.
- A temperature is a number, so it is regression.
Answer: Price: regression; X-ray: classification; temperature: regression - A spam filter is tested on 100 emails. Of 50 real spam emails it catches 45; of 50 genuine emails it correctly passes 40 and wrongly marks 10 as spam. Find its accuracy, precision and recall.
- Correct decisions = 45 spam caught + 40 genuine passed = 85, so accuracy = 85 ÷ 100 = 85%.
- It flagged 45 + 10 = 55 emails as spam, of which 45 really were: precision = 45 ÷ 55 ≈ 81.8%.
- Of the 50 real spam emails it caught 45: recall = 45 ÷ 50 = 90%.
Answer: Accuracy 85%, precision about 81.8%, recall 90% - Match each case to IaaS, PaaS or SaaS: (i) Sana’s company rents virtual servers and installs its own operating system; (ii) Rohan uploads his web app’s code and the provider runs it without him managing servers; (iii) a school uses an online office suite through the browser.
- (i) Renting raw virtual machines while managing the OS yourself is IaaS.
- (ii) Supplying only the code while the provider handles the OS and runtime is PaaS.
- (iii) Using a finished application through the browser is SaaS.
Answer: (i) IaaS, (ii) PaaS, (iii) SaaS - Imran says, “If someone changes one transaction in block 10 of a blockchain, nobody can notice.” Explain why he is wrong.
- Each block stores the hash of the block before it, and a hash changes completely if even one character of the data changes.
- Altering block 10 changes its hash, so the previous-hash value stored in block 11 no longer matches, and so on along the chain.
- Because many computers hold copies of the ledger, the altered copy also disagrees with the others and is rejected by consensus.
Answer: The broken hash links and the other copies of the ledger expose the change - A traffic camera network in Lahore produces millions of images every hour, along with sensor readings and text reports. Which big data Vs do the phrases “millions of images”, “every hour” and “images, readings and text” describe?
- Millions of images is the sheer amount of data: volume.
- Arriving every hour, continuously, is the speed of data: velocity.
- Images, numbers and text are different forms of data: variety.
Answer: Volume, velocity and variety
Exam shortcuts
- Draw three nested circles: AI outside, ML inside it, deep learning innermost.
- Labels present means supervised; no labels means unsupervised; rewards mean reinforcement.
- Number output means regression; category output means classification.
- For cloud models ask what you manage: the OS and up is IaaS, only your code is PaaS, nothing at all is SaaS.
- Blockchain questions almost always come back to one idea: each block holds the hash of the previous block.
- Big data: volume is how much, velocity is how fast, variety is how many kinds.
Common mistakes
- Treating AI, machine learning and deep learning as the same thing.
- Calling clustering supervised because the groups get names afterwards; the training data had no labels.
- Classifying web-based email or online office tools as IaaS; they are SaaS.
- Thinking blockchain data is stored on one central server; it is a distributed ledger.
- Judging a model only by its training accuracy, which hides overfitting.
Practice MCQs
- Which statement correctly describes how AI, machine learning and deep learning are related?
A) AI is part of machine learning, which is part of deep learning
B) The three are separate fields with no overlap
C) Deep learning is part of machine learning, which is part of AI
D) Machine learning is part of deep learning, which is part of AI
Answer: C) Deep learning is part of machine learning, which is part of AI — AI is the broadest field, machine learning is one approach within it, and deep learning is a kind of machine learning that uses many-layered neural networks. The other statements reverse the nesting or deny an overlap that clearly exists. - A model is trained on thousands of X-ray images, each marked by doctors as normal or showing disease. What kind of learning is this?
A) Association rule mining
B) Supervised learning
C) Unsupervised learning
D) Reinforcement learning
Answer: B) Supervised learning — Every training image carries the correct answer, so the model learns from labelled data, which is supervised learning. Unsupervised learning and association mining use unlabelled data, and reinforcement learning learns from rewards instead of labelled examples. - A shop has purchase records of its customers but no labels, and wants to group customers with similar buying habits. Which technique fits?
A) Reinforcement learning
B) Clustering
C) Classification
D) Regression
Answer: B) Clustering — Grouping unlabelled items by similarity is clustering, an unsupervised method. Regression and classification need labelled answers, and reinforcement learning needs an agent receiving rewards. - A program learns to play chess by playing many games and receiving a reward for wins and a penalty for losses. This is:
A) Supervised learning
B) A rule-based expert system
C) Unsupervised learning
D) Reinforcement learning
Answer: D) Reinforcement learning — Learning from rewards and penalties earned by its own actions is reinforcement learning. Supervised learning needs labelled examples, unsupervised learning looks for structure in unlabelled data, and an expert system follows rules written by human experts. - Predicting the selling price of a used car from its age, mileage and model is an example of:
A) Classification
B) Clustering
C) Regression
D) Association
Answer: C) Regression — The output is a number on a continuous scale, so the task is regression. Classification predicts a category, clustering groups unlabelled data, and association finds items that occur together. - Rabia’s company rents virtual machines and storage from a provider and installs and manages its own operating system and software. Which cloud service model is this?
A) SaaS
B) DaaS
C) IaaS
D) PaaS
Answer: C) IaaS — Renting basic infrastructure while managing the OS yourself is Infrastructure as a Service. In PaaS the provider manages the OS and runtime, in SaaS the whole application is provided, and DaaS (desktop or data as a service) is not one of the three main models. - Students use a web-based email service and an online word processor in their browsers without installing anything. Which cloud model do these belong to?
A) SaaS
B) PaaS
C) IaaS
D) Private cloud
Answer: A) SaaS — Complete applications delivered through the browser are Software as a Service. IaaS supplies raw infrastructure, PaaS supplies a platform for developers to run their own code, and private cloud is a deployment model, not a service model. - An organisation keeps sensitive records in its own private cloud but uses a public cloud for extra capacity during busy months. This is a:
A) Public cloud only
B) Hybrid cloud
C) Private cloud only
D) Community cloud
Answer: B) Hybrid cloud — Combining a private cloud with a public cloud is a hybrid deployment. A community cloud is shared by several organisations with common needs, and the other two describe using only one kind of cloud. - Smart electricity meters that automatically send readings to the supply company over the Internet are an example of:
A) The Internet of Things
B) Virtual reality
C) A rule-based expert system
D) Quantum computing
Answer: A) The Internet of Things — Physical devices with sensors that collect and share data over a network form the Internet of Things. Virtual reality creates simulated worlds, quantum computing uses qubits, and an expert system is rule-based software. - What links each block of a blockchain to the block before it?
A) A central server that numbers and stores every block
B) The hash of the previous block stored in it
C) A password shared by all users
D) An IP address of the block’s creator
Answer: B) The hash of the previous block stored in it — Each block contains the cryptographic hash of the previous block, so altering an earlier block breaks the chain. Blockchains are decentralised, so no central server or shared password holds them together, and IP addresses play no part in the linking. - In big data, the speed at which data is generated and must be processed, such as millions of card payments per minute, is called:
A) Velocity
B) Veracity
C) Volume
D) Variety
Answer: A) Velocity — Velocity is the rate at which data arrives. Volume is the amount of data, variety is the range of formats, and veracity is how trustworthy the data is. - A model scores 99% on its training data but only 60% on new test data. What is the most likely problem?
A) Underfitting
B) Too little training accuracy
C) Overfitting
D) Data encryption
Answer: C) Overfitting — Excellent training results with poor results on unseen data show the model memorised the training set, which is overfitting. Underfitting would show poor results on both sets, training accuracy here is high rather than low, and encryption has no bearing on model accuracy. - Which technology overlays digital information, such as directions or labels, on a live view of the real world?
A) Blockchain
B) Edge computing
C) Virtual reality
D) Augmented reality
Answer: D) Augmented reality — Augmented reality adds digital content on top of the real scene, for example through a phone camera. Virtual reality replaces the real world entirely, blockchain is a distributed ledger, and edge computing processes data near its source. - Translating Urdu text into English and answering customer questions through a chatbot are applications of which branch of AI?
A) Natural language processing
B) Reinforcement learning
C) Computer vision and image analysis
D) Robotics
Answer: A) Natural language processing — Working with human language, written or spoken, is natural language processing. Computer vision deals with images and video, robotics with physical machines, and reinforcement learning is a training method rather than a language application. - A model is tested on 200 new images and classifies 170 of them correctly. What is its accuracy?
A) 15%
B) 80%
C) 17%
D) 85%
Answer: D) 85% — Accuracy = correct ÷ total = 170 ÷ 200 = 0.85, or 85%. 15% is the error rate, 80% would need only 160 correct answers, and 17% misplaces the decimal point.
Questions
Is machine learning the same as AI?
No. AI is the whole field of making machines behave intelligently, including rule-based systems. Machine learning is one approach within AI, in which the system learns from data.
What is the simplest way to remember IaaS, PaaS and SaaS?
Think of how much the provider manages. IaaS gives you the hardware layer, PaaS adds the operating system and runtime so you only bring code, and SaaS gives you a finished application to use.
Is blockchain the same as Bitcoin?
No. Blockchain is the underlying technology, a distributed, tamper-evident ledger. Bitcoin is one cryptocurrency built on a blockchain, and blockchains have other uses such as supply-chain records.
What are the 3 Vs of big data?
Volume (how much data), velocity (how fast it arrives) and variety (how many different forms it takes). Many sources add veracity and value to make five.