CS442 – Introduction to Data Science: Midterm Important Subjective (30 Solved Q&As)
Virtual University of Pakistan • Read every solved subjective question with its model answer directly on this page. Free, no login required.
All 664 Midterm Packs · CS442 Course Page · CS442 MCQ Pack (100 MCQs)
-
Explain the four major components of Data Science.
Topic: Short Questions (3 Marks Each)
According to Module 1, the four major components are: 1. Data Strategy: Establishes business goals, data acquisition policies, and compliance. 2. Data Engineering: Focuses on end-to-end data management including sourcing, pipelines, cleansing, and storage. 3. Data Modeling & Analysis: Combines statistical models and software development to build predictive structures. 4. Data Visualization & Operationalization: Converts data into graphical dashboards (charts, tables) for decision-making.
-
What are the 5 Vs of Big Data? Briefly explain each.
Topic: Short Questions (3 Marks Each)
The 5 Vs representing Big Data properties (Module 3/25) are: 1. Volume: The sheer size/scale of data generated (e.g., terabytes or petabytes). 2. Velocity: The extreme speed at which new data is generated and needs processing (e.g., real-time streams). 3. Variety: The different formats of data (Structured, Semi-Structured, Unstructured). 4. Veracity: The trustworthiness, accuracy, and quality of the data. 5. Value: The business worth and actionable insights extracted from the data.
-
Differentiate between Structured, Semi-Structured, and Unstructured Data with examples.
Topic: Short Questions (3 Marks Each)
Based on Module 27, the differences are: • Structured Data: Highly organized data adhering to a pre-defined tabular model with rows & columns. Example: SQL tables, RDBMS database. • Semi-Structured Data: Does not follow strict tabular structures but contains tags, keys, or markers to separate data elements. Example: XML, JSON, CSV files. • Unstructured Data: Completely unformatted data that cannot be stored in tables. Example: Social media comments, videos, audio, PDFs.
-
Compare the primary roles of a Data Scientist and a Data Analyst.
Topic: Short Questions (3 Marks Each)
According to Module 4: • Data Scientist: Focuses on designing and developing new processes for data modeling and production using prototypes, machine learning algorithms, predictive models, and custom analysis. • Data Analyst: Focuses on examining existing datasets to identify trends, develop charts, and create visual presentations to help businesses make immediate strategic decisions.
-
What is Datafication? Give two real-world examples.
Topic: Short Questions (3 Marks Each)
Datafication is the transformation of social actions, behaviors, or physical phenomena into online, quantified data that can be tracked, monitored, and optimized (Module 5). Examples: 1. Google Maps: Transforms real-time physical location and movement into traffic flow data. 2. Netflix/Amazon Recommendation Engine: Transforms the user's social watching/shopping habits into quantified interest profiles.
-
What are the main statistics and storage challenges expected in the current data landscape by 2025?
Topic: Short Questions (3 Marks Each)
According to Module 6, the three key challenges are: 1. Exponential Growth: Global data creation is projected to grow past 180 zettabytes by 2025. 2. Low Retention: Only about 2% of the massive data produced annually is actually saved and retained. 3. Capacity Lag: Installed storage capacity is growing at a CAGR of 19.2%, lagging behind the rate of data generation, forcing enterprises to adopt highly cost-effective cloud infrastructures.
-
Differentiate between Descriptive Statistics and Inferential Statistics.
Topic: Short Questions (3 Marks Each)
Based on Module 9 and 12: • Descriptive Statistics: Focuses on summarizing and describing the characteristics of past data that is already fully known, using tables, charts, dashboards, and measures of central tendency/spread. • Inferential Statistics: Focuses on taking a random sample of data from a population, analyzing it, and using probability theory to draw conclusions or make predictions about the entire population.
-
Explain the distinct roles of Linear Algebra and Calculus in Data Science.
Topic: Short Questions (3 Marks Each)
According to Module 9, their distinct roles are: • Linear Algebra: Widely used for handling high-dimensional data, specifically in image recognition, text analysis, and dimensionality reduction (converting large matrices of features into smaller, manageable matrices). • Calculus: Primarily used for optimization techniques in training machine learning algorithms (e.g., gradient descent, which relies on derivatives to minimize cost functions).
-
Why is Domain Knowledge critical in Data Science? Who are SMEs?
Topic: Short Questions (3 Marks Each)
According to Module 10: • Importance: Domain knowledge is critical because precise and accurate problem definition is required for project success. It ensures precision and accuracy in the derived analysis results. • SMEs (Subject Matter Experts): Considered 'the king' of specific fields. They are invaluable because they know the exact source of business problems and precisely how specific data is produced and collected.
-
Differentiate between Quantitative and Qualitative variables, giving examples.
Topic: Short Questions (3 Marks Each)
Based on Module 14: • Quantitative Variables: Variables whose values consist of numbers, where differences represent real numerical scale. Examples: Height, Age, Population size, Number of students. • Qualitative (Categorical) Variables: Variables consisting of discrete categories designated by words or labels, representing non-numeric differences. Examples: Gender, Marital status, Eye color, Level of education.
-
Differentiate between Discrete and Continuous variables.
Topic: Short Questions (3 Marks Each)
According to Module 14: • Discrete Variables: Variables whose attributes are completely separate from one another and represent a finite number of values. They are qualitative and measured on nominal or ordinal scales. Example: Number of cars. • Continuous Variables: Variables that can take on any value (infinite fraction) between two specified points. They are quantitative and measured on interval or ratio scales. Example: Height.
-
Differentiate between Nominal and Ordinal variables, with examples.
Topic: Short Questions (3 Marks Each)
Based on Module 14: • Nominal Variables: Categorical variables that do not have any natural order, ranking, or physical distance. Any numeric coding is completely arbitrary. Examples: Gender, Eye color, Language. • Ordinal Variables: Categorical variables that possess a natural, ordered category, but the exact mathematical distance between categories is unknown. Examples: Customer satisfaction level (Happy, Satisfied, Unhappy), GCSE Grades.
-
What is the Inter-Quartile Range (IQR)? State its alternative names and formula.
Topic: Short Questions (3 Marks Each)
According to Module 15, the Inter-Quartile Range (IQR) is a measure of statistical dispersion (data spread): • Formula: It is calculated as the difference between the 75th percentile (Third Quartile, Q3) and the 25th percentile (First Quartile, Q1). IQR = Q3 - Q1. • Alternative Names: It is also called the midspread, middle 50%, or H-spread. It represents the spread of the middle half of the dataset.
-
Differentiate between a Population and a Sample, and state their notation symbols.
Topic: Short Questions (3 Marks Each)
Based on Module 13 and 16, a Population is the entire group of interest, while a Sample is a subset of that population selected for analysis. Their notation symbols are: 1. Size: Population = N, Sample = n 2. Mean: Population = µ, Sample = x̄ 3. Standard Deviation: Population = σ (or δ in slide), Sample = s 4. Percentage: Population = π, Sample = p
-
What are the three main types of statistical models? Define each.
Topic: Short Questions (3 Marks Each)
According to Module 17, the three main types of statistical models are: 1. Parametric Models: Finite-dimensional models with a finite number of parameters (e.g., Normal Distribution, Linear Regression, ANOVA). 2. Non-Parametric Models: Models that do not conform to a normal distribution, relying on continuous data or ordinal/nominal numbers (e.g., Chi-Square, Wilcoxon Rank Test). 3. Semi-Parametric Models: Regression models that contain both parametric and non-parametric components (e.g., Cox Proportional Hazards).
-
Explain the Poisson Distribution Model and list three real-world examples.
Topic: Short Questions (3 Marks Each)
According to Module 18, the Poisson Distribution Model is a parametric model where: • Data consists of counts of occurrences. • Events are completely independent. • The mean number of occurrences stays constant during data collection. Examples: 1) Number of incoming calls in a telecom call center. 2) Number of hits on a website. 3) Number of accidents on a particular section of road.
-
Explain the Four-Stage Model Structure in Transport Modeling.
Topic: Short Questions (3 Marks Each)
According to Module 18, the four sequential stages of transport modeling are: 1. Trip Generation: Predicts the total number of trips originating or ending in each zone (based on work, education, shopping). 2. Trip Distribution: Links trip origins to trip destinations, typically using the Gravity Model. 3. Mode Choice: Determines the percentage of trips using different transport modes (Own Car, Bus, Taxi, Metro). 4. Assignment: Allocates trips to specific routes in the transport network.
-
Differentiate between a Data Warehouse and a Data Lake.
Topic: Short Questions (3 Marks Each)
Based on the comparison table in Module 33/34: • Data Warehouse: Stores highly structured, processed data. It utilizes a schema-on-write approach, is expensive for massive raw data volumes, and is used primarily by business professionals. • Data Lake: Stores raw, unstructured, semi-structured, and structured data in all formats. It utilizes a schema-on-read approach, is designed for low-cost storage, and is highly agile for data scientists.
-
Differentiate between XML and HTML.
Topic: Short Questions (3 Marks Each)
Based on Module 29: 1. Purpose: XML is designed to store and transport data; HTML is designed to display data. 2. Tags: XML uses user-defined, custom tags; HTML uses predefined tags (like <h1>, <p>). 3. Nesting/Syntax: XML is case-sensitive, requires strict nesting, and must have an end-tag; HTML is case-insensitive and is highly tolerant of missing end-tags.
-
State the advantages of JSON over XML.
Topic: Short Questions (3 Marks Each)
According to Module 30, JSON has several key advantages over XML: 1. Smaller Size: JSON lacks verbose opening/closing markup tags, resulting in smaller file sizes and reduced bandwidth footprint. 2. Faster Parsing: Browsers can parse JSON directly as a native JavaScript object, making it much faster to process than XML which requires complex DOM parsers. 3. Readability: JSON utilizes clean key-value structures that are highly intuitive and easy for humans to read and write.
-
Compare SQL and NoSQL databases in detail. Discuss their structures, schemas, scaling, transactions, and appropriate use cases.
Topic: Long Questions (5 Marks Each)
1. Data Model & Structure: • SQL: Relational Database Management Systems (RDBMS). Data is stored in highly structured tables composed of rows and columns. Relationships are established via primary and foreign keys. • NoSQL: Not Only SQL. Data is stored in flexible structures, allowing all related data to reside in a single document or key-value pair without split tables. 2. Schemas: • SQL: Utilizes strict, rigid, pre-defined schemas. Schema changes require table alterations and can cause system downtime. • NoSQL: Utilizes dynamic, unstructured schemas. Documents can be created without a defined structure first, enabling polymorphic data. 3. Scalability: • SQL: Scales vertically (by upgrading the CPU, RAM, or SSD of a single server). It has limited horizontal scalability. • NoSQL: Scales horizontally (by partitioning data across thousands of cheap, distributed commodity servers), making it highly scalable for big data. 4. Transaction Support & Integrity: • SQL: Guarantees strong ACID (Atomicity, Consistency, Isolation, Durability) properties, ensuring absolute data integrity. • NoSQL: Follows the BASE (Basically Available, Soft state, Eventual consistency) model, sacrificing strict real-time consistency for extreme write performance and availability. 5. Pros, Cons & Examples: • SQL Pros/Cons: High data integrity, flexible queries, but rigid schemas. Examples: Oracle, MySQL, MS SQL, PostgreSQL. • NoSQL Pros/Cons: Extremely fast, dynamic schema, horizontal scaling, but lacks complex joins and strong ACID. Examples: MongoDB, Cassandra, DynamoDB, HBase.
-
Explain the OSEMN Data Science Process in detail. Discuss what each letter stands for and the primary tasks of each stage.
Topic: Long Questions (5 Marks Each)
The OSEMN model (originally proposed by Hilary Mason and Chris Wiggins, Module 63) is a standard 5-step lifecycle for data science projects: 1. O - OBTAIN (Gather Data): • Task: Involves collecting and gathering raw data from various relevant sources. • Methods: Querying relational databases, downloading CSV/JSON logs, scraping websites, calling APIs, or connecting to unstructured data repositories (Data Lakes). 2. S - SCRUB (Clean Data): • Task: Transforming and cleaning the raw data into a structured format that machines can easily understand. • Methods: Handling missing values (replacing nulls with column averages), removing duplicate records, correcting formatting errors, and standardizing data fields. 3. E - EXPLORE (Find Significant Patterns): • Task: Performing Exploratory Data Analysis (EDA) to understand data distributions and identify hidden correlations. • Methods: Calculating statistical metrics (mean, standard deviation, correlation), generating data visualizations (histograms, scatter plots, box plots), and performing univariate/bivariate analysis. 4. M - MODEL (Construct Models): • Task: Constructing predictive statistical and machine learning models to forecast or classify outcomes. • Methods: Implementing machine learning algorithms (Linear/Logistic Regression, Random Forests, k-Means, DBSCAN) and splitting data into training and test sets. 5. N - iNTERPRET (Put Results to Good Use): • Task: Communicating findings, interpreting model results, and deploying the model into production environments. • Methods: Building interactive dashboards, writing reports for top management, and writing automation scripts for real-time predictions.
-
Discuss the Apache Hadoop and Apache Spark Big Data frameworks. Explain HDFS, MapReduce, compare Hadoop with Spark, and list Spark's sub-libraries.
Topic: Long Questions (5 Marks Each)
1. Apache Hadoop Architecture: Hadoop (Module 31) is an open-source Big Data framework comprising two core components: • HDFS (Hadoop File System): A highly fault-tolerant, scalable distributed file system designed to store massive datasets across cheap commodity hardware. It uses a 'share nothing' architecture. • MapReduce: A distributed data processing software framework. It operates in two stages: the Map stage splits and filters data, and the Reduce stage aggregates results. 2. Hadoop vs. Apache Spark Comparison: • Processing Speed: Hadoop MapReduce writes all intermediate processing results back to physical disks, making it slower. Apache Spark processes data in-memory, yielding up to 100x faster speeds. • Ease of Use: Hadoop requires verbose Java code. Spark provides high-level APIs in Python, Scala, and Java, making it much more developer-friendly. • Processing Models: Hadoop is primarily batch-processing. Spark supports batch, real-time streaming, machine learning, and graph computations. 3. The Apache Spark Ecosystem Libraries: Spark (Module 32) consists of a core engine and four highly integrated libraries: 1. Spark Streaming: Processes real-time, live data streams continuously. 2. Spark SQL: Exposes Spark datasets using relational SQL queries over JDBC/ODBC and APIs. 3. Spark MLlib: A comprehensive machine learning library containing built-in algorithms (Regression, Clustering, Classification, Filtering). 4. Spark GraphX: An API built for graphs and graph-parallel distributed computations.
-
Explain the Data Wrangling Process in detail. Discuss the six core tasks involved according to the course syllabus.
Topic: Long Questions (5 Marks Each)
Data Wrangling (also known as Data Munging, Module 47) is the process of organizing, completing, and standardizing raw data to ensure easy access, consolidation, and ready automation for business intelligence. According to Module 48, the process is divided into six critical sequential tasks: 1. DISCOVERING: • Involves performing a high-level inspection of the raw dataset to understand what the data represents, what variables exist, and how it can be useful for analytical exploration. 2. STRUCTURING: • Raw data often arrives in fragmented, unaligned shapes and sizes. Structuring is the physical formatting of all data fields to align them with traditional applications (e.g., parsing raw log text into a structured spreadsheet). 3. CLEANING: • The most critical task. It involves fixing missing values, removing corrupted records, correcting typo inconsistencies, and standardizing fields to prevent distortions in subsequent models. 4. ENRICHING: • Taking advantage of the wrangled data to add value. This includes computing new columns (e.g., extracting 'Year' from a full 'Date' field), aggregating values, or joining additional datasets to add new features. 5. VALIDATING: • Running diagnostic checks to identify and surface data quality issues. It ensures that the cleaned and structured data meets predefined business rules and logical constraints. 6. PUBLISHING: • Delivering the final, polished, and standardized dataset to the downstream storage system (like a clean database or data warehouse) where it can be directly consumed by BI reports or ML models.
-
Compare the ETL and ELT data integration processes. Discuss their workflows, staging requirements, pros, and cons.
Topic: Long Questions (5 Marks Each)
1. Workflow Differences: • ETL (Extract, Transform, Load): Data is extracted from the source systems, sent to a temporary Staging Area where transformations are performed (cleansing, formatting, converting), and only then is the clean data loaded into the target Data Warehouse (Module 51). • ELT (Extract, Load, Transform): Data is extracted from source systems and immediately loaded into the target storage (usually a low-cost Data Lake). Transformations are performed directly within the target system on-demand utilizing its native computing power. 2. Technical Staging & Storage: • ETL: Requires a dedicated staging server to transform data before loading. It does not utilize a Data Lake. Best for smaller, highly structured, sensitive datasets. • ELT: Does not require data staging. It directly leverages modern Data Lake architectures. Best suited for massive, high-velocity Big Data pipelines and real-time data streaming. 3. Comparative Analysis (Pros and Cons): • ETL Pros: Highly mature process, easy to manage, reduces load volume in the warehouse, excellent for data compliance. • ETL Cons: Slower loading times because transformation must occur first, and data formats are hard to change later. • ELT Pros: Extremely fast loading times, highly automated, stores all raw data, very flexible (schema-on-read). • ELT Cons: TCO (Total Cost of Ownership) can be higher as cloud compute increases, and security/governance are harder to maintain in raw data lakes.
-
Explain the six core dimensions of Data Quality. Discuss how each dimension impacts business decisions.
Topic: Long Questions (5 Marks Each)
Data Quality (Module 50) is the cornerstone of reliable Data Science. It is defined across six major dimensions: 1. DATA CONSISTENCY: • Definition: Keeping information uniform across the network and between various database applications on a system. • Types: 1) Point-in-time consistency, 2) Transaction consistency, and 3) Application consistency. Inconsistent data leads to conflicting business reports. 2. DATA COMPLETENESS: • Definition: The percentage of all required data entries currently available in a dataset. • Impact: Measured by missing records/fields. For example, a database column of 500 rows with 100 missing entries has a completeness of 80%. High incompleteness can cause massive financial losses (e.g., losing bank transaction records). 3. DATA ACCURACY: • Definition: Error-free data records that reflect real-world facts correctly. Accurate data serves as a reliable source of information for modeling. 4. DATA VALIDITY: • Definition: The delivery of clean, clear data that conforms to logical syntax, formatting rules, and integrity constraints (e.g., a phone number containing only digits). 5. DATA UNIQUENESS: • Definition: Ensuring there are zero duplicate records. Duplicates distort counts, skew statistical averages (mean, standard deviation), and lead to outdated customer targeting. 6. DATA TIMELINESS: • Definition: The degree to which data represents physical reality at the required point in time. Outdated data makes predictive models highly inaccurate.
-
Analyze the role of Cloud Computing in Data Science. Discuss cloud types and the four cloud service models.
Topic: Long Questions (5 Marks Each)
1. The Role of Cloud in Data Science: Data Science and Cloud Computing go hand-in-hand (Module 20). The astronomical volume of Big Data generated today makes local storage and computation impossible. The cloud provides: 1) Economical storage, 2) Robust security, 3) Seamless scalability, and 4) Choice of massive open-source (Hadoop, Python, Spark) and commercial (Tableau, MS SQL, Oracle) tools. 2. The Three Cloud Deployment Types: • Private Cloud: Cloud infrastructure operated solely for a single organization. High security, but high setup cost. • Public Cloud: Services rendered over a public network owned by third-party providers (e.g., AWS, GCP, Azure). Highly scalable and cost-effective. • Hybrid Cloud: Combines private and public clouds, allowing data and apps to be shared between them. Best for regulatory compliance and elastic scaling. 3. The Four Cloud Service Models: • SaaS (Software as a Service): Complete web-based software applications managed entirely by the provider (e.g., Google Suite, Salesforce). • DaaS (Data as a Service): Provides raw or processed data streams on-demand to customers via APIs, eliminating local data storage costs. • PaaS (Platform as a Service): Provides development, runtime environment, and operating systems where data scientists can build, test, and deploy models (e.g., Google App Engine). • IaaS (Infrastructure as a Service): Provides raw computing power, servers, virtual machines, and storage on-demand (e.g., AWS EC2, Google Compute Engine).
-
Compare Python, R, and Java programming languages in the context of Data Science. Discuss their general properties, libraries, database handling, and learning curves.
Topic: Long Questions (5 Marks Each)
1. General Properties & Objective: • Python: A general-purpose, interpreted, object-oriented programming language designed for clear syntax and remarkable code power (Module 57). Perfect for ML, web development, and scripting. • R: A functional programming language and environment specifically built by and for statisticians for statistical modeling, graphics, and EDA (Module 60). • Java: A statically typed, object-oriented language. It is extremely fast and robust, acting as the foundation for enterprise legacy systems and Big Data engines (Hadoop, HBase) (Module 61). 2. Essential Packages & Libraries: • Python: Rich, growing ecosystem: NumPy, Pandas, SciPy, Matplotlib, Seaborn, Scikit Learn, TensorFlow, PyTorch, Keras, NLTK. • R: Specialized libraries: caret, stringr, ggplot2, knitr, tidyverse, markdown, shiny. • Java: Machine learning libraries like Weka, Deeplearning4j, and Big Data framework APIs. 3. Database Handling & Execution Speed: • Python: Easily handles large datasets due to minor memory constraints. Moderate execution speed (interpreted). • R: Computes entirely in RAM. Highly limited by physical memory size, making it poor at handling massive Big Data datasets. • Java: Native connectivity, extremely fast execution speed (statically compiled), and excellent at handling high-volume concurrent databases. 4. Learning Curve & Code Length: • Python: Very easy to learn, short lines of code, highly readable syntax. • R: Functional syntax is easy for statisticians but has a steep learning curve for general programmers. Indexes start at 1. • Java: Complex, verbose syntax requiring long lines of code, leading to a steep learning curve.
-
Explain the concept of Transport Modeling in Data Science. Discuss the four-stage model structure and the Gravity Model for trip distribution.
Topic: Long Questions (5 Marks Each)
1. Definition of Transport Modeling: Transport modeling (Module 18) allows the synthesis of travel behavior and the prediction of future transport demands. It is widely used in new dynamic traffic control, route guidance systems, and urban planning networks under normal and incident conditions. 2. The Four-Stage Model Structure: 1. Trip Generation: Establishes how many trips start or end in a specific study zone (Residential, Commercial, Industry, Retail). Trips are categorized by purpose (Work, Education, Shopping, Recreation). 2. Trip Distribution: Links trip origins to trip destinations, matching origin zones with destination zones across the region. 3. Mode Choice: Calculates the proportion of trips that will utilize different transport modes (Own Car, Bus, Taxi, Metro). 4. Assignment: Allocates the trips using a specific mode onto physical routes in the road/rail network to predict exact traffic volume. 3. The Gravity Model for Trip Distribution: The second stage (Trip Distribution) is mathematically modeled using the Gravity Model: Tij = a × Oi × Dj × f(Cij) Where: • Tij: The predicted number of trips traveling between origin zone i and destination zone j. • Oi & Dj: Measures of size/attraction of origin zone i and destination zone j. • f(Cij): A deterrence function representing the cost (time, money, distance) of traveling between zone i and zone j. Trips decrease as travel cost increases, mirroring Newton's law of gravity.
-
Demonstrate how Data Wrangling is practically performed using Python, Excel, and SQL, providing syntax and function examples from the course.
Topic: Long Questions (5 Marks Each)
Data Wrangling is performed across different tool stacks depending on the dataset scale (Modules 54, 55, 56): 1. DATA WRANGLING USING PYTHON (Pandas): Data Scientists use the Pandas library to clean and manipulate dataframes. A classic task is identifying and replacing null values in a dataset: • Syntax: import pandas as pd df = pd.DataFrame(data) # Calculate column average, ignoring NaNs: avg = df['Marks'].mean() # Replace NaNs with the calculated average: df['Marks'] = df['Marks'].fillna(avg) 2. DATA WRANGLING USING EXCEL: Excel provides rich built-in formulas to perform rapid data wrangling on spreadsheets: • MAX / MIN: Used to find outlier extremes in scale data (e.g., =MAX(G2:G11)). • TRIM: Removes all double or leading/trailing spaces from text entries (e.g., =TRIM(B2)). • LEFT / RIGHT / MID: Extracts substrings from text values (e.g., =LEFT(B2, 2) to extract first two characters). • LOWER / UPPER: Standardizes text case to prevent duplicates. 3. DATA WRANGLING USING DATABASE (SQL): When data resides in relational tables, wrangling is performed directly via SQL queries on RDBMS: • Handling Outliers: SELECT MAX(scale), MIN(scale) FROM BPS_DATA; • Removing Spaces: The SQL TRIM() function strips leading/trailing whitespaces from text columns: SELECT TRIM(employee_name) FROM BPS_DATA; • Extracting Substrings: SUBSTR() (or SUBSTRING()) extracts specific character sets: SELECT SUBSTR(gender, 1, 2) FROM BPS_DATA; (extracts first two characters).