30 Data Science & SQL Quiz Questions & Answers
SQL queries, Python Pandas, machine learning models, data analytics, and statistics.
Below are 30 data science & sql quiz questions with the correct answer and a short explanation for each. Use them to revise, host a quiz night, or prepare for competitions โ then challenge yourself with the timed, interactive version on QuizOxa.
Data Science & SQL Quiz Questions and Answers
Q1. What does SQL stand for in data management?
โ Answer: Structured Query Language
๐ก SQL (Structured Query Language) is the standard domain-specific language used to manage and query relational databases.
Q2. Which SQL keyword is used to extract data from a database table?
โ Answer: SELECT
๐ก The `SELECT` statement is used to fetch data from one or more database tables.
Q3. In Data Science, which Python library is most famous for dataframe manipulation and tabular data analysis?
โ Answer: Pandas
๐ก Pandas provides high-performance DataFrames and tools for analyzing structured numerical and categorical tables.
Q4. Which SQL clause is used to filter query results based on specified conditions?
โ Answer: WHERE
๐ก The `WHERE` clause filters rows before any grouping or aggregation takes place.
Q5. What is Machine Learning?
โ Answer: A branch of AI where systems learn pattern rules from data without explicit programming
๐ก Machine Learning uses algorithms that discover patterns in historical data to make automated predictions.
Q6. What type of chart is best suited for demonstrating trends over continuous time intervals?
โ Answer: Line Chart
๐ก Line charts effectively illustrate continuous trends and fluctuations over time.
Q7. In statistics, how is the 'Mean' of a numerical dataset calculated?
โ Answer: The sum of all values divided by the count of values
๐ก The mean (arithmetic average) equals the total sum divided by the number of observations.
Q8. Which core Python library provides fast multi-dimensional array operations and matrix math?
โ Answer: NumPy
๐ก NumPy (Numerical Python) is the foundational package for scientific computing in Python, providing n-dimensional arrays.
Q9. What does CSV stand for in tabular data files?
โ Answer: Comma-Separated Values
๐ก CSV files store tabular data in plain text, with each line representing a record separated by commas.
Q10. Which SQL clause sorts the returned records in ascending or descending order?
โ Answer: ORDER BY
๐ก The `ORDER BY` clause sorts result sets by specified columns (ASC by default, or DESC).
Q11. What is the difference between INNER JOIN and LEFT JOIN in SQL?
โ Answer: INNER JOIN returns only matching rows; LEFT JOIN returns all rows from the left table plus matched rows
๐ก INNER JOIN selects records with matching values in both tables. LEFT JOIN retains all records from the left table even if unmatched.
Q12. In SQL, which clause is required alongside aggregate functions like COUNT(), SUM(), or AVG() to group results by column?
โ Answer: GROUP BY
๐ก The `GROUP BY` statement groups rows that have the same values in specified columns into summary rows.
Q13. What is 'Overfitting' in machine learning models?
โ Answer: When a model memorizes training data noise and fails to generalize on new unseen data
๐ก Overfitting occurs when a model learns training data details and noise so closely that it negatively impacts new test data performance.
Q14. In statistics, what is the 'Median' of a dataset?
โ Answer: The middle score when values are arranged in ascending numerical order
๐ก The median represents the exact 50th percentile mark separating the higher half from the lower half of data.
Q15. Which machine learning paradigm groups unlabeled data points together based on inherent feature similarities?
โ Answer: Unsupervised Learning (Clustering)
๐ก Unsupervised learning (e.g., K-Means clustering) analyzes unlabeled data to uncover hidden patterns or natural groupings.
Q16. What is the key difference between WHERE and HAVING clauses in SQL?
โ Answer: WHERE filters individual rows before grouping; HAVING filters aggregate groups after GROUP BY
๐ก WHERE filters rows before aggregation occurs. HAVING filters summary rows after GROUP BY aggregations are calculated.
Q17. What is a Confusion Matrix used for in classification data science?
โ Answer: A table showing True Positives, False Positives, True Negatives, and False Negatives to evaluate model accuracy
๐ก A confusion matrix reports performance of a classification model, calculating precision, recall, and F1-score.
Q18. What is Data Cleaning (or Data Wrangling)?
โ Answer: Detecting and correcting corrupt, incomplete, inaccurate, or duplicate data entries
๐ก Data cleaning prepares raw data for analysis by addressing missing values, outliers, structural errors, and duplicates.
Q19. Which SQL database constraint uniquely identifies each row in a table and cannot contain NULL values?
โ Answer: PRIMARY KEY
๐ก A PRIMARY KEY constraint enforces unique identification for table records and strictly prohibits NULL values.
Q20. What is a Box Plot (Box-and-Whisker plot) useful for in exploratory data analysis?
โ Answer: Visualizing median, quartiles, interquartile range (IQR), and identifying data outliers
๐ก Box plots provide a 5-number visual summary (Min, Q1, Median, Q3, Max) and highlight extreme outliers.
Q21. What is the Bias-Variance Tradeoff in machine learning models?
โ Answer: Balancing underfitting caused by high bias against overfitting caused by high variance
๐ก High bias causes underfitting (over-simplified models), while high variance causes overfitting (sensitivity to noise); tuning balances both.
Q22. In advanced SQL analytics, what is a Window Function (e.g., `ROW_NUMBER() OVER(PARTITION BY...)`)?
โ Answer: A function performing calculations across a set of table rows related to the current row without collapsing them into a single row
๐ก SQL Window functions compute values over row partitions while preserving individual row identity in the output.
Q23. What is A/B Testing in data science and experimentation?
โ Answer: A randomized experiment comparing two variants (A and B) to test statistical significance of a change
๐ก A/B testing uses hypothesis testing to measure whether a variant produces a statistically significant change in user behavior.
Q24. What is Gradient Descent in machine learning optimization?
โ Answer: An algorithm that iteratively adjusts model parameters to minimize a cost/loss function
๐ก Gradient descent calculates the gradient of the loss function to update model weights in the direction of steepest descent.
Q25. What does the p-value represent in statistical hypothesis testing?
โ Answer: The probability of obtaining results at least as extreme as observed, assuming the null hypothesis is true
๐ก A low p-value (typically โค 0.05) indicates that the observed data is unlikely under the null hypothesis, leading to rejection of the null.
Q26. What is Principal Component Analysis (PCA)?
โ Answer: A linear dimensionality reduction technique that transforms correlated features into uncorrelated principal components
๐ก PCA reduces high-dimensional data feature spaces while retaining maximum variance across principal orthogonal axes.
Q27. In SQL databases, what does the `COALESCE()` function evaluate to?
โ Answer: The first non-NULL value among its argument list
๐ก `COALESCE(val1, val2, val3)` inspects arguments in order and returns the first argument that is not NULL.
Q28. What is a Random Forest in machine learning?
โ Answer: An ensemble learning method that constructs a multitude of decision trees and merges their predictions
๐ก Random Forest combines decision trees trained on random data subsets (bagging) to improve accuracy and control overfitting.
Q29. What is Normalization (Min-Max Scaling) in feature engineering?
โ Answer: Rescaling numerical feature values into a fixed range, typically between 0 and 1
๐ก Min-Max scaling transforms features so that all values fit within [0, 1], preventing features with larger scales from dominating algorithms.
Q30. In SQL, what is a Common Table Expression (CTE) defined using the `WITH` clause?
โ Answer: A temporary named result set existing only within the execution scope of a query
๐ก CTEs simplify complex queries by creating temporary named result sets that can be referenced within SELECT, INSERT, or UPDATE statements.
Ready to Test Yourself?
You've read the answers โ now see how many you actually remember. The interactive Data Science & SQL quiz picks questions at random, adds a countdown timer, and tracks your score.