Home / Computer Science / Class XII / Understanding Data
Understanding Data — CUET Computer Science hero
Class XII 💻 Computer Science Ch 7 of 20

Understanding Data

CUET unit: Understanding Data

📌 Snapshot

  • How raw data turns into decisions: structured and unstructured data, the processing cycle, mean, median and mode.
  • Which statistic to pick for a given problem, and why the mean fails when one extreme value sneaks in.
  • Worked examples of mean, median, mode, range and standard deviation, with every step shown in a table.
  • The input, processing and output stages of the data processing cycle, with ATM, admit card and ticket examples.

📖 Detailed Notes

Written and reviewed by Rohit Singh, Computer Science & Commerce faculty at UniDrill (MCA, Osmania University · 6 years teaching). Based on NCERT Computer Science Class XII, Chapter 7.

Why does a college brochure not just print its raw placement list?

Imagine a college has kept the records of about 2,000 placed students over three years: company, package, branch. Reading that list tells you almost nothing. The brochure instead says things like "average package" and "most students were placed in this range". The data had to be gathered, processed and summarised before anyone could decide anything. That is the whole chapter in one idea: data is only useful after it is collected, stored, processed and summarised.

What is data?

Data is a collection of characters, numbers and other symbols that represent values of some situations or variables. The word "data" is plural, and its singular is datum. Raw data does not tell you much by itself, so we process it into information: a table, a chart or a sentence that supports a decision. When you withdraw cash, the bank must update your account; a weather office watches satellite data for a cyclone; an airline sets ticket prices by looking at demand and supply. In each case the decision is only as good as the data behind it.

Data comes from many places: personal details such as name, age and phone number, bank and ticket transactions, images, audio and video, documents and web pages, online posts and messages, sensor signals and satellite readings. Storing it electronically makes processing much faster than doing it by hand.

Structured and unstructured data

Data is classified into two broad types on the basis of its format.

Feature Structured data Unstructured data
Format Well defined, fixed pattern No fixed row and column pattern
How it is stored Tables: each column is an attribute (characteristic or variable), each row is one observation Files of different kinds, with no standard layout
Examples Inventory table, fee records, ATM withdrawal records, a CSV file Newspaper page, email, web page with images and video, text document, audio or video file, social media message
How easy to process Easy with a spreadsheet or database Needs special handling; often described using metadata

Worked example: a table is structured data. A shop keeps the following kitchen items in a table with the attributes ModelNo, ProductName, Unit Price, Discount(%) and Items_in_Inventory.

ModelNo ProductName Unit Price Discount(%) Items_in_Inventory
ABC1 Water bottle 126 8 13
ABC2 Melamine Plates 320 5 45
ABC3 Dinner Set 4200 10 8
GH67 Jug 80 0 10

The table has 5 attributes (columns) and 4 observations (rows). Because it is structured, the owner can sum the Items_in_Inventory column to count all items, or multiply Unit Price by Items_in_Inventory for each row and add the results to get the total value of the stock. Such calculations are impossible on a pile of loose emails.

Metadata is data about data. It is used to describe unstructured data. For an email, the subject, recipient, main body and attachment details are metadata. For an image file, the size (in KB or MB), the type (JPEG or PNG) and the resolution are metadata. The pixels themselves are the data; the facts about the file are the metadata.

Beyond the textbook. For the exam: a photograph is unstructured, and its size, type and resolution are metadata. In reality: the same photo file usually carries more metadata than that, such as the date it was taken and the camera model, which is why sharing original photos can reveal more than you intended. Metadata helps computers organise unstructured data, such as sorting a gallery by date.

Data collection and storage

Data collection means identifying data that is already available or gathering it from appropriate sources. Take a grocery shop's sales data. It can exist in three states, and each needs a different first step.

Where the data is What to do
In a diary or register Enter it in a digital format, for example a spreadsheet
Already digital, for example in a CSV (comma separated values) file Use it as it is
Not recorded anywhere Develop software (for example in Python) that stores the data in a CSV file or in a database such as MySQL

Data storage is storing data on a device so it can be retrieved later. Common devices are the hard disk drive (HDD), solid state drive (SSD), CD/DVD, tape drive, pen drive and memory card. Falling prices of storage have made it practical to keep the huge amount of data being produced.

Data is usually kept as files, and programs are written to add, change or delete data in them. This file processing has limits that a database management system (DBMS) overcomes, which is the subject of the next chapter.

Data processing

Data processing converts raw data (numbers, text, images) into information (tables, charts, text). The data process cycle has three stages.

Stage Activities in it
Input Data collection, data preparation, data entry
Processing Store, retrieve, classify, update
Output Reports, results, a processing system

The easy way to remember where an activity belongs is to ask what it does to the data. If it brings data in, it is input. If it works on data already inside, it is processing. If it hands something back to the user, it is output.

Worked example: the same cycle in three real tasks. Each task starts from a problem, takes some inputs, processes them and gives an output.

Task Inputs Processing Output
Admit card for a competitive exam Name, address, qualification, marks, photo and signature, centre choice, fee payment details Check that the details are correct, that the applicant is eligible and that fees, photo and signature are in; generate a roll number and add the applicant to the eligible list Admit card with roll number, centre address, date and time
Cash withdrawal at an ATM PIN, account type and number, card number, ATM location, date and time, amount Check that the PIN is valid and the balance is enough; deduct the amount and count the notes; start printing the receipt Currency notes and a printed slip
Train ticket Start and end stations, date, number of tickets, class, berth preference, passenger names and ages, contact and payment details Check the login details and availability, deduct the tickets from the coach total after payment, allocate a PNR and berths or a waiting number Ticket with berth and coach number, or a ticket with a waiting list number

Pause and predict: In the ATM example, "deducting the withdrawn amount from the account" belongs to which stage of the data process cycle?

Check your answer: Processing. It acts on data already stored inside the bank's system (the balance) and updates it. Typing the PIN is input, and the printed slip is output.

Statistical techniques: summarising data

A table with 2,000 rows cannot be read at a glance, so we summarise it with a few numbers. Two families are used.

Family Question it answers Techniques
Measures of central tendency What is a typical value? Mean, median, mode
Measures of variability (dispersion) How spread out are the values? Range, standard deviation

Two different data sets can have the same mean but a very different spread, so you often need one from each family.

We will use one data set for all five techniques. The heights (in cm) of nine students are 90, 102, 110, 115, 85, 90, 100, 110, 110.

Mean: the balance point

The mean (average) is the sum of the values divided by how many there are.

$$\bar{x} = \dfrac{x_1 + x_2 + \dots + x_n}{n} = \dfrac{\sum_{i=1}^{n} x_i}{n}$$

For the heights the sum is 912 and $n = 9$, so the mean is $912 / 9 = 101.33$ cm. The mean uses every value, which is its strength and also its weakness: one extreme value drags it along. An exceptionally large or small value compared with the rest is called an outlier. Outliers are usually treated as errors, and they should be removed before the mean is calculated.

Median: the middle value

Sort the data in ascending or descending order. The median is the middle value, so half the data lies on each side. With an odd number of values, it is the value at the middle position. With an even number, it is the average of the two middle values.

Sorted heights: 85, 90, 90, 100, 102, 110, 110, 110, 115. There are 9 values, so the median is the value at position 5, which is 102 cm.

Mode: the most frequent value

The mode is the value that occurs most often. A data set has no mode if every value occurs only once, and it can have more than one mode if several values tie for the highest frequency. Mode is the only one of the three that also works on non-numeric data, such as the most popular colour of cars.

In the heights, 110 occurs three times, more than any other value, so the mode is 110 cm.

Range: the widest gap

The range is the maximum minus the minimum, so it works only for numerical data. For the heights it is $115 - 85 = 30$ cm. Because it uses only the two extreme values, an outlier distorts it badly.

Standard deviation: the typical distance from the mean

The standard deviation $\sigma$ (sigma) looks at every value. It is the positive square root of the average of the squared differences between each value and the mean.

$$\sigma = \sqrt{\dfrac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n}}$$

A small $\sigma$ means the data is packed close to the mean; a large $\sigma$ means it is spread out. The squaring is there because deviations above and below the mean would otherwise cancel to zero. Taking the square root at the end brings the answer back to the original unit (cm, not cm squared).

Worked example: standard deviation of the heights. The mean is $\bar{x} = 101.33$.

Height $x$ (cm) $x - \bar{x}$ $(x - \bar{x})^2$
90 -11.33 128.37
102 0.67 0.36
110 8.67 75.17
115 13.67 186.87
85 -16.33 266.67
90 -11.33 128.37
100 -1.33 1.77
110 8.67 75.17
110 8.67 75.17
Total about 0 938.00

Average of the squares: $938 / 9 = 104.22$. Square root: $\sigma = \sqrt{104.22} \approx 10.2$ cm. A common wrong step is to divide by 8 instead of 9, or to forget the square root and quote 104.22. In this chapter you divide by $n$, the number of values.

Worked example: a simple one you can do in your head. Take 2, 4, 4, 4, 5, 5, 7, 9.

Step Working Result
Mean $(2+4+4+4+5+5+7+9) / 8 = 40 / 8$ 5
Deviations -3, -1, -1, -1, 0, 0, 2, 4
Squares 9, 1, 1, 1, 0, 0, 4, 16 Sum = 32
Average of squares $32 / 8$ 4
Square root $\sqrt{4}$ $\sigma = 2$

Why the mean fails and the median doesn't

Worked example: one outlier. Monthly pay (in thousands of rupees) of five employees is 18, 20, 22, 24, 26. A sixth employee joins at 200.

Before (5 values) After (6 values)
Mean $110 / 5 = 22$ $310 / 6 \approx 51.67$
Median 22 (middle value) $(22 + 24) / 2 = 23$ (average of the two middle values)
Range $26 - 18 = 8$ $200 - 18 = 182$

The mean more than doubled and the range exploded, yet the median barely moved. That is why the median is the safer summary for incomes and house prices, and why the mean should be used only after removing outliers.

Pause and predict: Two classes each have three students. Class A scored 48, 50, 52 and Class B scored 30, 50, 70. Which statistic is identical for both classes, and which statistic tells them apart?

Check your answer: The mean and median are both 50 for each class. The range (4 versus 40) and the standard deviation (about 1.6 versus about 16.3) separate them. The averages hide the fact that Class B is far more varied.

Beyond the textbook. For the exam: standard deviation divides the squared deviations by $n$. In reality: statisticians distinguish a whole population from a sample taken from it, and for a sample they divide by $n - 1$. When you reach the Pandas chapters you will see that a Pandas std() uses $n - 1$ by default, while NumPy's std() divides by $n$, so the two can give slightly different numbers for the same data.

Which technique should I use?

Problem Technique Why
Average performance of a whole class in a test Mean Uses all marks
Typical income when a few people earn far more Median Not pulled by extremes
Most popular colour of car, or the dominant value Mode Works on non-numeric data and counts frequency
Disparity between the highest and lowest salaries Range Max minus min
How varied the salaries or heights are overall Standard deviation Considers every value
Compare heights or incomes of residents of two cities Mean or median, plus a measure of spread Centre and spread together

Formula sheet

Quantity Formula Unit When to use
Mean $\bar{x} = \dfrac{\sum x_i}{n}$ Same as data Numeric data without outliers
Median Middle value of sorted data; average of two middle values if $n$ is even Same as data Skewed data or outliers
Mode Most frequent value Same as data Any data, including non-numeric
Range $\text{Maximum} - \text{Minimum}$ Same as data Quick spread of numeric data
Standard deviation $\sigma = \sqrt{\dfrac{\sum (x_i - \bar{x})^2}{n}}$ Same as data Spread using all the values

Exam traps

The trap Why it's tempting The truth
"An email is structured data." It has a subject, a recipient and a body It has no fixed row and column structure, so it is unstructured
"Metadata is the content of the file." It sounds like extra data inside Metadata is data about data, such as image size, type and resolution
"Range uses all the values." It measures spread, like standard deviation It uses only the maximum and the minimum
"The mean is best when the data has outliers." The mean is the famous average Outliers pull the mean; use the median or remove the outliers
"The median of an even number of values is the lower middle one." Odd-sized examples dominate It is the average of the two middle values
"Mean works for the most popular sport." Mean is the first measure learned Sport names are not numbers; use mode
"A data set always has exactly one mode." The word sounds singular There may be several modes, or none if all values occur once
"Storing data is part of the output stage." Saving feels like the end Store, retrieve, classify and update belong to processing

60-second revision

Topic Lock this in
Data / datum Data is plural; datum is singular
Structured Rows (observations) and columns (attributes)
Unstructured Email, newspaper, image, video, social media post
Metadata Data about data (email subject; image size, type, resolution)
Collection Register to spreadsheet; CSV already digital; no data yet means software
Storage devices HDD, SSD, CD/DVD, tape drive, pen drive, memory card
Process cycle Input (collect, prepare, enter) then Processing (store, retrieve, classify, update) then Output (reports, results)
Heights example Mean 101.33 cm, median 102 cm, mode 110 cm, range 30 cm, $\sigma \approx 10.2$ cm
Outliers Distort mean and range, barely touch median
$\sigma$ Root of the average squared deviation from the mean, divide by $n$

Where this chapter connects

🎯 Practice MCQs

First 3 questions free · create a free account to unlock the rest — answers & explanations included, no payment needed

Q1. Which of the following is the best description of data?

▸ Show answer & explanation

Answer: B

Data is the raw collection of symbols. Option A describes information, which is data after processing, and options C and D describe other things.

Q2. Which of the following is an example of structured data?

▸ Show answer & explanation

Answer: C

Structured data fits a fixed row and column format, with each column an attribute and each row an observation. The newspaper, the email and the post have no fixed layout, so they are unstructured.

Q3. Statement I: Metadata is data about data. Statement II: Image size, image type and image resolution are examples of metadata of an image file. Which is correct?

▸ Show answer & explanation

Answer: C

Metadata describes other data, and the size, type and resolution of an image describe the image file rather than its pixels. Both statements are therefore correct.

🔒 12 more practice MCQs

Create a free account to unlock every MCQ in this chapter — answers and explanations included. No payment needed.

Already registered? Just log in and they'll all appear here.

📊 Previous-Year Questions

Practise with real CUET Computer Science previous-year papers — every question solved, with the correct answer and a step-by-step explanation.

View solved CUET PYQ papers →

Ready to drill Computer Science?

Unlock all MCQs, chapter tests, mocks & PYQs for ₹199/year.

Get UniDrill Pro