Data Mining, Past Papers

Data Mining Past Paper 2025 BSCS UOS

Data Mining Past Paper 2025 BS 7th Term UOS

University of Sargodha (UOS) BS Computer Science 7th term Data Mining (CSEC-407) past paper 2025 – clean printable paper, text version and solved answers, including kNN and Apriori worked examples.

Print / download (A4, high quality): Full-size paper

Data Mining Past Paper 2025 – BSCS 7th Term | University of Sargodha (UOS)

Looking for the Data Mining Past Paper 2025 from the University of Sargodha (UOS) for BSCS 7th Term? You’re at the right place.

This official question paper includes both objective and subjective parts, covering key topics such as:

  • Data Warehousing
  • Data Transformation
  • Clustering & Association
  • Web Mining
  • Genetic Algorithms
  • Decision Trees
  • Apriori Algorithm and more…

This past paper helps you prepare for your final exams by giving insights into question formats and important concepts typically asked in the subject.

Original paper (scanned copy)

The clean paper above is retyped by Shining Study from this original University of Sargodha question paper. Click the scan to view it full size.

Data Mining Past Paper 2025 BS 7th Term UOS – original scan

Solved answers

Q1 – Short questions

(i) To discover useful, previously unknown patterns, relationships and trends in large datasets and turn them into knowledge for prediction and decision-making (e.g. customer buying patterns, fraud detection).

(ii) Data warehouse: a large, subject-oriented, integrated, time-variant and non-volatile repository that stores historical data collected from many operational sources, organised for querying, reporting and analysis (OLAP).

(iii) Data transformation example: min–max normalization of income from the range 12,000–98,000 to 0–1: v′ = (v − min)/(max − min); an income of 73,600 becomes (73,600 − 12,000)/86,000 ≈ 0.716. Other examples: converting dates to “age”, or categories to numeric codes.

(iv) Feature reduction: reducing the number of input attributes by selecting the most relevant ones (feature selection) or combining them into fewer new features (feature extraction, e.g. PCA), to remove redundancy and noise, speed up learning and avoid overfitting.

(v) Learning machine: a system or algorithm that improves its performance on a task from data/experience instead of being explicitly programmed – it builds a model from training examples and uses it to predict or classify new data (e.g. SVM, neural network).

(vi) Outlier analysis: identifies values that deviate strongly from the rest of the data (errors, noise or rare events). In data preparation it helps detect and correct or remove wrong values so models are not distorted; in some applications (fraud, intrusion detection) the outliers themselves are the target.

(vii) Artificial neural network: a model inspired by the brain, made of layers of interconnected neurons (input, hidden, output). Each neuron computes a weighted sum of inputs plus bias and passes it through an activation function; weights are learned with backpropagation. Used for classification, prediction and pattern recognition.

(viii) Cluster analysis: grouping objects so that objects in the same cluster are similar and different from those in other clusters, without predefined labels – used for customer segmentation, document grouping, image segmentation and anomaly detection (e.g. k-means).

(ix) Association rule: an if–then rule X ⇒ Y showing items that frequently occur together, measured by support and confidence. Example: {bread, butter} ⇒ {milk} (support 20%, confidence 75%) in market-basket analysis.

(x) Web mining example: an online store analysing web server logs and clickstreams (web usage mining) to recommend products – “customers who viewed this also viewed…”; or Google ranking pages using link structure (web structure mining, PageRank).

(xi) Genetic algorithm: a search and optimization method based on natural evolution: a population of candidate solutions (chromosomes) is evaluated by a fitness function, and better ones are selected and combined using crossover and mutation over generations until a good solution is found.

(xii) WEKA (others: RapidMiner, KNIME, Orange, Python scikit-learn).

Q2 – Data mining process (KDD)

Data mining is one step of the Knowledge Discovery in Databases (KDD) process, which turns raw data into useful knowledge:

  1. Understanding the problem/goal: define the business objective and success criteria.
  2. Data selection/collection: identify and gather relevant data from databases, warehouses, files or the web.
  3. Data cleaning (preprocessing): handle missing values, remove noise, duplicates and outliers, fix inconsistencies.
  4. Data integration: combine data from multiple sources into a coherent store, resolving schema and value conflicts.
  5. Data transformation and reduction: normalize, aggregate, discretize, encode; reduce dimensions or sample to make data suitable for mining.
  6. Data mining: apply algorithms – classification, clustering, association rules, regression – to extract patterns.
  7. Pattern evaluation: identify truly interesting patterns using measures such as accuracy, support, confidence, novelty and usefulness.
  8. Knowledge presentation and deployment: present results with visualizations and reports and use them in decision-making.

The process is iterative; CRISP-DM describes similar phases: business understanding, data understanding, data preparation, modeling, evaluation, deployment.

Q3 – Methods for handling missing data

1. Deletion (ignoring the tuple / listwise deletion): remove records (or attributes) with missing values. Pros: very simple, no invented values, unbiased if data are missing completely at random. Cons: loses information and reduces sample size; can introduce bias when missingness is related to other values; wasteful when many records have only one missing attribute.

2. Imputation (filling in values): replace the missing value with an estimate – a global constant (“Unknown”), the attribute mean/median/mode, the mean of the same class, or a predicted value using regression, kNN or decision trees. Pros: keeps all records and the full dataset size; model-based imputation can be quite accurate. Cons: mean/mode imputation reduces variance and can distort relationships; predicted values may introduce bias and are only estimates; more complex methods cost time.

(Some algorithms such as C4.5 decision trees can also handle missing values internally.)

Q4 – k-Nearest Neighbours (kNN)

kNN is a simple, instance-based (lazy) supervised learning algorithm. It stores all training examples and classifies a new point by looking at its k closest training points.

  1. Choose k (e.g. 3) and a distance measure (usually Euclidean: d = √Σ(xᵢ − yᵢ)²).
  2. Compute the distance from the new point to every training point.
  3. Select the k nearest neighbours.
  4. Classification: assign the majority class among them (regression: average their values).

Example: classify a fruit with weight 6 and size 6 using k = 3.

Training data (weight, size) -> class
A (5, 5) -> Orange      d = √(1+1)   = 1.41
B (6, 7) -> Orange      d = √(0+1)   = 1.00
C (8, 8) -> Apple       d = √(4+4)   = 2.83
D (7, 6) -> Apple       d = √(1+0)   = 1.00
E (2, 3) -> Orange      d = √(16+9)  = 5.00

3 nearest: B (Orange, 1.00), D (Apple, 1.00), A (Orange, 1.41)
Votes: Orange 2, Apple 1  ->  predicted class = Orange

Notes: features should be normalized; small k is sensitive to noise, large k blurs class boundaries (odd k avoids ties); prediction is slow for large datasets because all distances must be computed.

Q5 – Decision tree

A decision tree is a flowchart-like tree used for classification/regression: each internal node tests an attribute, each branch is an outcome of the test, and each leaf holds a class label. A path from root to leaf forms an if–then rule.

Main steps (ID3/C4.5/CART):

  1. Start with all training tuples at the root.
  2. Select the best splitting attribute using an attribute-selection measure – information gain (ID3), gain ratio (C4.5) or Gini index (CART). Entropy: Info(D) = −Σ pᵢ log₂ pᵢ; Gain(A) = Info(D) − Info_A(D).
  3. Create a node for that attribute and a branch for each of its values (or binary split); partition the tuples accordingly.
  4. Recursively repeat on each partition with the remaining attributes.
  5. Stop when all tuples in a node belong to the same class, no attributes remain (use majority class), or the partition is empty / too small.
  6. Prune the tree (pre-pruning or post-pruning) to remove branches that reflect noise and avoid overfitting.
  7. Use the tree to classify new data and evaluate accuracy on a test set.

Example: “buys computer?” – root tests age; youth → test student; middle-aged → yes; senior → test credit rating.

Q6 – Apriori algorithm

Apriori finds frequent itemsets and generates association rules. It uses the Apriori property: every subset of a frequent itemset must be frequent, so candidates with an infrequent subset are pruned. It works level by level: find frequent 1-itemsets (L1), join them to make candidate 2-itemsets (C2), count support, keep frequent ones (L2), and so on until no new frequent itemsets appear. Then rules X ⇒ Y are formed and kept if confidence ≥ minimum.

Example (minimum support = 2 transactions, minimum confidence = 60%):

T1: {Bread, Milk}
T2: {Bread, Butter, Eggs}
T3: {Milk, Butter, Eggs}
T4: {Bread, Milk, Butter}
T5: {Bread, Milk, Butter, Eggs}

C1/L1 counts: Bread 4, Milk 4, Butter 4, Eggs 3          -> all frequent
C2 counts:   {Bread,Milk} 3   {Bread,Butter} 3  {Bread,Eggs} 2
             {Milk,Butter} 3  {Milk,Eggs} 2     {Butter,Eggs} 3   -> all frequent (>= 2)
C3 counts:   {Bread,Milk,Butter} 2   {Bread,Butter,Eggs} 2
             {Milk,Butter,Eggs} 2    {Bread,Milk,Eggs} 1 (pruned)
L3: {Bread,Milk,Butter}, {Bread,Butter,Eggs}, {Milk,Butter,Eggs}
C4: {Bread,Milk,Butter,Eggs} has subset {Bread,Milk,Eggs} not frequent -> pruned. Stop.

Sample rules:
  Eggs ⇒ Butter            conf = 3/3 = 100%   ✓
  {Bread, Milk} ⇒ Butter   conf = 2/3 = 67%    ✓
  Bread ⇒ Milk             conf = 3/4 = 75%    ✓

Strengths: simple, easy to understand. Weaknesses: many candidate sets and repeated database scans for large data (FP-Growth improves this).

Answers prepared by Shining Study for revision. Check them against your class notes and teacher’s guidance.

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.