Data Science with Python Certification — Questions and Answers
Question 1: A data scientist has a 2D NumPy array representing daily sales data for 4 products over 6 days, with a shape of (6, 4). They need to transform this array so that each row represents a product and each column represents a day. Which of the following NumPy operations will correctly perform this transformation?
- arr.reshape(4, 6)
- np.vsplit(arr, 2)
- np.transpose(arr) (Correct answer)
- np.ravel(arr)
Correct answer: np.transpose(arr)
The `np.transpose()` function, or the `.T` attribute, permutes the dimensions of an array. For a 2D array, this is equivalent to swapping the rows and columns. The original shape is (6, 4), and transposing it will result in a shape of (4, 6), which correctly aligns products with rows and days with columns.
Question 2: In the context of text feature engineering, what does TF-IDF penalize compared to a raw term frequency vector?
- Terms with very short character length
- Terms that appear only once in a document
- Terms that appear in very few documents
- Terms that appear frequently across many documents (Correct answer)
Correct answer: Terms that appear frequently across many documents
TF-IDF down-weights terms that appear in many documents (high IDF denominator), reducing the influence of common words like 'the' or 'is'.
Question 3: What is the primary risk of applying target encoding before performing cross-validation?
- Multicollinearity in features
- Loss of categorical information
- Data leakage from the target variable (Correct answer)
- Increased training time
Correct answer: Data leakage from the target variable
Applying target encoding before cross-validation leaks target information into the training folds, causing overly optimistic model evaluation.
Question 4: In a normal distribution, approximately what percentage of data falls within one standard deviation of the mean?
- 68% (Correct answer)
- 50%
- 99.7%
- 95%
Correct answer: 68%
In a normal distribution approximately 68% of data falls within ±1 standard deviation of the mean per the empirical rule.
Question 5: In Isolation Forest, how are anomalies detected?
- Anomalies are isolated in fewer splits than normal points (Correct answer)
- Anomalies are points far from cluster centroids
- Anomalies are identified by negative eigenvalues
- Anomalies have the highest density in random subspaces
Correct answer: Anomalies are isolated in fewer splits than normal points
Isolation Forest isolates anomalies using random partitioning trees; anomalies require fewer splits because they differ from most points.
Question 6: What does the pandas method df.merge() perform?
- Stacks two DataFrames vertically
- Removes duplicate rows across two DataFrames
- Joins two DataFrames horizontally based on common key column(s) (Correct answer)
- Concatenates two DataFrames ignoring the index
Correct answer: Joins two DataFrames horizontally based on common key column(s)
df.merge() combines two DataFrames by matching rows on one or more key columns, similar to SQL JOIN operations.
Question 7: When using `CountVectorizer` in scikit-learn, what does setting `ngram_range=(1, 2)` do?
- Includes both unigrams and bigrams as features in the document-term matrix (Correct answer)
- Restricts documents to a length of 1 to 2 sentences
- Applies L1 and L2 normalization to the feature vectors
- Limits the vocabulary to words appearing between 1 and 2 times
Correct answer: Includes both unigrams and bigrams as features in the document-term matrix
`ngram_range=(1, 2)` instructs the vectorizer to extract all unigrams (single words) and bigrams (word pairs), increasing feature richness at the cost of a larger vocabulary.
Question 8: When you index a NumPy array with another integer array (fancy indexing), does the result share memory with the original?
- Only if both arrays have the same dtype
- Yes, it always returns a view
- Only if the index array is sorted
- No, it returns a copy (Correct answer)
Correct answer: No, it returns a copy
Fancy (advanced) indexing always returns a copy, not a view, of the selected elements.
Question 9: Which evaluation metric is most appropriate for a text classification task where class distribution is highly imbalanced?
- Mean Squared Error
- Perplexity
- F1-score (macro or weighted) (Correct answer)
- Accuracy
Correct answer: F1-score (macro or weighted)
Accuracy is misleading when classes are imbalanced because a model can achieve high accuracy by predicting only the majority class; F1-score balances precision and recall across classes.
Question 10: What is a confidence interval in statistics?
- A range likely to contain the true population parameter (Correct answer)
- The probability that a sample mean equals the population mean
- The minimum sample size required for significance
- The standard deviation of the sampling distribution
Correct answer: A range likely to contain the true population parameter
A confidence interval provides a range of values within which the true population parameter is likely to fall with a specified probability.
Question 11: You join two DataFrames and end up with columns 'price_x' and 'price_y'. What caused this?
- A merge conflict occurred and pandas duplicated the column
- Both DataFrames had a column named 'price' and suffixes were added automatically (Correct answer)
- The join key was named 'price'
- The column types were incompatible
Correct answer: Both DataFrames had a column named 'price' and suffixes were added automatically
When both DataFrames share a non-key column name, pandas appends _x and _y suffixes to distinguish them.
Question 12: Which step in the Expectation-Maximization (EM) algorithm computes the probability of each point belonging to each cluster?
- E-step (Expectation) (Correct answer)
- Initialization step
- M-step (Maximization)
- Convergence check step
Correct answer: E-step (Expectation)
The E-step computes posterior probabilities (responsibilities) of cluster membership for each data point.
Question 13: What qualifies as not a property of an ndarray object?
- length (Correct answer)
- dtype
- ndim
- shape
Correct answer: length
A NumPy ndarray exposes attributes like shape, dtype, ndim, and size, but there is no 'length' attribute. To get the number of elements you use .size, and len() returns only the first-axis length — neither is a property called 'length'. So 'length' is the one that is not a valid ndarray attribute.
Question 14: Which method in pandas returns the number of missing values per column?
- df.count_nan()
- df.isna().sum() (Correct answer)
- df.missing()
- df.null_count()
Correct answer: df.isna().sum()
`df.isna()` returns a boolean DataFrame and `.sum()` aggregates True values (NaN) per column.
Question 15: What does Named Entity Recognition (NER) identify in text?
- Real-world entities such as persons, organizations, and locations (Correct answer)
- The sentiment polarity of each sentence
- Grammatical dependencies between words in a sentence
- Duplicate or near-duplicate sentences in a corpus
Correct answer: Real-world entities such as persons, organizations, and locations
NER classifies text spans as named entities (PERSON, ORG, GPE, DATE, etc.), enabling extraction of structured information from unstructured text.
Question 16: What does the cophenetic correlation coefficient measure in hierarchical clustering?
- The height at which clusters merge
- How faithfully the dendrogram preserves pairwise distances (Correct answer)
- The within-cluster sum of squares
- The number of optimal clusters
Correct answer: How faithfully the dendrogram preserves pairwise distances
The cophenetic correlation coefficient compares original pairwise distances to dendrogram distances to evaluate linkage quality.
Question 17: How does `np.concatenate` differ from `np.stack`?
- They are identical in behavior
- concatenate works only on 1-D arrays
- concatenate joins along an existing axis; stack creates a new axis (Correct answer)
- stack joins along an existing axis; concatenate creates a new axis
Correct answer: concatenate joins along an existing axis; stack creates a new axis
`np.concatenate` joins arrays along an existing axis, while `np.stack` joins a sequence of arrays along a *new* axis.
Question 18: In Matplotlib, which command adds a legend to the current axes using labels provided in plot() calls?
- plt.label()
- plt.add_legend()
- plt.legend() (Correct answer)
- plt.show_legend()
Correct answer: plt.legend()
plt.legend() automatically creates a legend using labels assigned via the 'label' parameter in plot functions.
Question 19: Which measure of central tendency is most resistant to outliers?
- Mean
- Mode
- Median (Correct answer)
- Variance
Correct answer: Median
The median is resistant to outliers because it is based on rank position rather than the actual values of extremes.
Question 20: Which pandas method reshapes data from wide format to long format?
- df.stack()
- df.pivot()
- df.melt() (Correct answer)
- df.unstack()
Correct answer: df.melt()
df.melt() unpivots a DataFrame from wide to long format, making column headers into values.
Question 21: In pandas, what does df.duplicated().sum() compute?
- The index of the first duplicated row
- The sum of all duplicated values across columns
- The number of columns with duplicate names
- The total number of duplicate rows in the DataFrame (Correct answer)
Correct answer: The total number of duplicate rows in the DataFrame
df.duplicated() returns a boolean Series marking duplicate rows, and .sum() counts how many are True.
Question 22: What is the primary purpose of removing stop words in NLP preprocessing?
- To correct spelling errors in the text
- To reduce vocabulary size and eliminate low-information words (Correct answer)
- To split sentences into individual characters
- To convert words to their base grammatical form
Correct answer: To reduce vocabulary size and eliminate low-information words
Stop words like 'the', 'is', and 'and' carry little semantic meaning; removing them reduces noise and shrinks the feature space.
Question 23: Which evaluation metric is most appropriate when false negatives are more costly than false positives, such as in cancer detection?
- Specificity
- Recall (Correct answer)
- Precision
- F1 Score
Correct answer: Recall
Recall (sensitivity) measures the proportion of actual positives correctly identified, minimizing missed cases (false negatives).
Question 24: What kind of data can be used to satisfy the needs of an application that has datasets that are not suited for an RDBMS yet require order and hierarchy
- Unstructured
- Complex
- Semi-structured (Correct answer)
- Structured
Correct answer: Semi-structured
Explanation: <br> Semi-structured data is suitable to address the requirement for an application having datasets that are not suitable for a Relational Database Management System (RDBMS) but still require order and hierarchy.
Question 25: Which method on a scikit-learn vectorizer both learns the vocabulary and transforms the training data in one step?
- partial_fit()
- transform()
- fit()
- fit_transform() (Correct answer)
Correct answer: fit_transform()
`fit_transform()` combines `fit()` (learn vocabulary/IDF) and `transform()` (convert documents to feature matrix) in a single efficient pass over training data.
Question 26: Which Python library provides the `AgglomerativeClustering` class?
- sklearn.cluster (Correct answer)
- scipy.cluster
- numpy.cluster
- pandas.cluster
Correct answer: sklearn.cluster
`AgglomerativeClustering` is part of scikit-learn's `sklearn.cluster` module.
Question 27: Given a Pandas DataFrame named `sales`, which of the following code snippets correctly calculates the total sales for each 'Region' by summing the 'Sales' column?
- sales.groupby('Region')['Sales'].sum() (Correct answer)
- sales.pivot(index='Region', values='Sales', aggfunc='sum')
- sales.sum('Sales').by('Region')
- sales.aggregate('Sales').on('Region')
Correct answer: sales.groupby('Region')['Sales'].sum()
The `groupby()` method is used to split the DataFrame into groups based on some criteria, in this case, the 'Region' column. Then, `['Sales']` selects the 'Sales' column from each group, and `.sum()` is an aggregation function that calculates the sum of the 'Sales' for each region.
Question 28: Which Python function calculates the standard error of the mean?
- pandas.mean()
- numpy.std()
- scipy.stats.ttest_1samp()
- scipy.stats.sem() (Correct answer)
Correct answer: scipy.stats.sem()
`scipy.stats.sem()` calculates the standard error of the mean for a given sample array.
Question 29: Which of the following scenarios is the primary reason for converting a column's data type from `object` to a more specific type like `int` or `float` during data cleaning?
- To prepare the data for export to a JSON file, which requires numeric types.
- To make the DataFrame display more aesthetically pleasing.
- To enable mathematical operations and improve memory efficiency. (Correct answer)
- To ensure all columns have the same number of unique values.
Correct answer: To enable mathematical operations and improve memory efficiency.
Columns with an `object` dtype often store strings, which prevents numerical calculations. Converting them to `int` or `float` using methods like `astype()` or `pd.to_numeric()` is essential for performing mathematical and statistical operations. Additionally, numeric types are generally more memory-efficient than object types.
Question 30: A feature representing 'customer_spending' in a dataset is heavily right-skewed, with most values being low but with a long tail of very high-spending customers. Many linear machine learning models perform better with normally distributed features. What is a common and effective transformation to apply to this feature to make its distribution more symmetric?
- Using binning to group the spending values into discrete categories like 'low', 'medium', and 'high'.
- Applying Standardization, which will center the data around a mean of 0.
- Applying a logarithmic transformation (e.g., `np.log1p`) to compress the higher values and expand the lower values. (Correct answer)
- Using Min-Max scaling to scale all values to a fixed range between 0 and 1.
Correct answer: Applying a logarithmic transformation (e.g., `np.log1p`) to compress the higher values and expand the lower values.
A logarithmic transformation is a powerful and common method for handling right-skewed data. It compresses the range of large values more than it compresses the range of small values, which effectively pulls the long tail in towards the center of the distribution, making it more symmetric and closer to a normal distribution. [1, 6, 14, 22]
Question 31: What does `pd.date_range()` generate in pandas?
- A datetime index parsed from a CSV column
- A random sample of dates from a distribution
- A list of business days between two dates only
- A fixed-frequency sequence of datetime values (Correct answer)
Correct answer: A fixed-frequency sequence of datetime values
`pd.date_range()` generates a fixed-frequency DatetimeIndex useful for creating or reindexing time series data.
Question 32: What does df.astype({'age': 'int32', 'score': 'float32'}) accomplish?
- Casts the specified columns to new data types to reduce memory usage (Correct answer)
- Rounds age and score to 32 decimal places
- Drops rows where age or score are non-numeric
- Renames the columns age and score
Correct answer: Casts the specified columns to new data types to reduce memory usage
astype() with a dict changes each named column to the specified dtype, which can significantly reduce memory footprint.
Question 33: In a Random Forest, what technique introduces randomness when building each tree?
- Pruning by information gain
- Gradient boosting on residuals
- L2 regularization on leaf nodes
- Bootstrap sampling and random feature subsets (Correct answer)
Correct answer: Bootstrap sampling and random feature subsets
Random Forest uses bootstrap sampling of data rows and random subsets of features at each split, reducing correlation between trees.
Question 34: What does df.pivot_table(values='sales', index='region', columns='quarter', aggfunc='sum') produce?
- A long-format DataFrame with one row per combination
- A heatmap of the sales data
- A cross-tabulation showing total sales per region per quarter (Correct answer)
- A Series of total sales grouped by region only
Correct answer: A cross-tabulation showing total sales per region per quarter
pivot_table() creates a 2D summary table where rows are regions, columns are quarters, and cells contain summed sales values.
Question 35: What is the purpose of the inplace=True parameter in methods like df.drop()?
- Returns a copy of the modified DataFrame
- Modifies the DataFrame in memory without requiring reassignment (Correct answer)
- Applies the operation to all columns at once
- Prevents the operation from being undone
Correct answer: Modifies the DataFrame in memory without requiring reassignment
inplace=True modifies the existing DataFrame object directly instead of returning a new one.
Question 36: Which sklearn class is designed to apply different transformers to different subsets of columns in a single pipeline step?
- FunctionTransformer
- Pipeline
- FeatureUnion
- ColumnTransformer (Correct answer)
Correct answer: ColumnTransformer
ColumnTransformer allows specifying different preprocessing pipelines for different column subsets (e.g., numeric vs. categorical) within one object.
Question 37: To ensure a consistent and professional look for all visualizations in a report, you want to apply a specific color scheme to all subsequent Seaborn plots. Which function should be used to set a default color palette, such as 'colorblind'?
- sns.style(palette='colorblind')
- sns.set(palette='colorblind')
- sns.color_palette('colorblind')
- sns.set_palette('colorblind') (Correct answer)
Correct answer: sns.set_palette('colorblind')
The `sns.set_palette()` function is used to set the default color palette for all subsequent plots created with Seaborn. While `sns.color_palette()` returns a list of colors for a palette, `sns.set_palette()` actually applies it as the default.
Question 38: When splitting data into train and test sets, why must any imputation be fit ONLY on the training set?
- Because test data may have different dtypes
- Because sklearn Pipelines require it
- To prevent data leakage where test statistics influence training preprocessing (Correct answer)
- To reduce computation time during cross-validation
Correct answer: To prevent data leakage where test statistics influence training preprocessing
Fitting on all data before splitting leaks test set statistics into training, producing overly optimistic performance estimates.
Question 39: What is the purpose of seasonal decomposition in time series analysis?
- To convert the series to stationary form only
- To separate a series into trend, seasonal, and residual components (Correct answer)
- To automatically calculate ARIMA parameters
- To remove outliers from the series
Correct answer: To separate a series into trend, seasonal, and residual components
Seasonal decomposition splits a time series into trend, seasonal, and irregular residual components for separate analysis.
Question 40: Which NumPy function returns the indices that would sort an array?
- np.rank()
- np.sortindex()
- np.argsort() (Correct answer)
- np.sort()
Correct answer: np.argsort()
np.argsort() returns the integer indices that would sort the array, not the sorted values themselves.
Question 41: How do you compute a rolling 7-day mean on column 'price' in a DataFrame df?
- df['price'].rolling(7).mean() (Correct answer)
- df['price'].shift(7).mean()
- df['price'].resample('7D').mean()
- df['price'].mean(window=7)
Correct answer: df['price'].rolling(7).mean()
rolling(7).mean() computes a sliding window average over 7 consecutive observations.
Question 42: What is the key assumption of the Gaussian Mixture Model (GMM)?
- All clusters have equal covariance
- The number of components equals the number of features
- Data must be standardized before fitting
- Data is generated from a mixture of Gaussian distributions (Correct answer)
Correct answer: Data is generated from a mixture of Gaussian distributions
GMM assumes each data point is generated from one of several Gaussian distributions with unknown parameters.
Question 43: What is a bigram in NLP?
- A two-layer neural network for text classification
- A document encoded with two separate embedding methods
- A pair of characters used in character-level modeling
- A sequence of two consecutive words used as a single feature (Correct answer)
Correct answer: A sequence of two consecutive words used as a single feature
A bigram is an n-gram where n=2, capturing pairs of adjacent words (e.g., 'machine learning') to preserve some local word order context.
Question 44: What is the primary purpose of differencing in time series preprocessing?
- To normalize the values to a 0-1 range
- To remove trends and make the series stationary (Correct answer)
- To add seasonal patterns to the data
- To fill missing timestamps in the index
Correct answer: To remove trends and make the series stationary
Differencing computes consecutive changes between observations to remove trends and achieve stationarity required by ARIMA.
Question 45: What is the key difference between NumPy's `ravel()` and `flatten()` methods when used to convert a multi-dimensional array into a 1D array?
- `flatten()` can only be used on 2D arrays, while `ravel()` works on any dimension.
- `ravel()` returns a view of the original array whenever possible, while `flatten()` always returns a new copy. (Correct answer)
- There is no functional difference; they are aliases for the same operation.
- `ravel()` always returns a copy, while `flatten()` returns a view.
Correct answer: `ravel()` returns a view of the original array whenever possible, while `flatten()` always returns a new copy.
The fundamental difference is that `flatten()` always allocates new memory and returns a copy of the data. In contrast, `ravel()` is more memory-efficient as it returns a view of the original array if possible, meaning modifications to the raveled array can affect the original array.
Question 46: Which of the following correctly creates a dictionary using a dictionary comprehension?
- (x: x**2 for x in range(5))
- {x, x**2 for x in range(5)}
- {x: x**2 for x in range(5)} (Correct answer)
- [x: x**2 for x in range(5)]
Correct answer: {x: x**2 for x in range(5)}
Dictionary comprehensions use curly braces with a `key: value` expression followed by a `for` clause.
Question 47: What does `np.searchsorted(sorted_arr, values, side='right')` return?
- The nearest element to each value
- Insertion indices so that inserting values keeps sorted_arr sorted, using right-side insertion (Correct answer)
- The count of elements less than each value
- The index of each value if it exists, otherwise -1
Correct answer: Insertion indices so that inserting values keeps sorted_arr sorted, using right-side insertion
`searchsorted` with `side='right'` returns the rightmost index at which each value can be inserted to maintain sorted order.
Question 48: What is the bias-variance tradeoff implication of increasing model complexity on a fixed dataset?
- Both bias and variance decrease
- Bias decreases and variance increases (Correct answer)
- Bias increases and variance decreases
- Both bias and variance increase
Correct answer: Bias decreases and variance increases
More complex models fit training data more closely (lower bias) but become sensitive to noise, increasing variance and risking overfitting.
Question 49: What is the purpose of the learning_rate parameter in Gradient Boosting?
- Shrinks the contribution of each tree to prevent overfitting (Correct answer)
- Sets the depth of individual trees
- Controls the number of trees in the ensemble
- Determines the fraction of samples used for each tree
Correct answer: Shrinks the contribution of each tree to prevent overfitting
A smaller learning_rate means each tree contributes less, requiring more trees but often yielding better generalization.
Question 50: Which of the following is a key assumption of Linear Regression that, if violated, can lead to unreliable and biased coefficient estimates?
- The relationship between the independent and dependent variables is non-linear.
- The independent variables must be perfectly correlated with each other.
- The dependent variable must be categorical.
- The residuals (error terms) are independent of each other. (Correct answer)
Correct answer: The residuals (error terms) are independent of each other.
A critical assumption of linear regression is the independence of residuals (or errors). This means that the error for one observation is not correlated with the error of another. Violation of this assumption, known as autocorrelation, is common in time-series data and leads to inefficient and biased estimates of the model coefficients.
Question 51: Which method detects duplicate rows in a pandas DataFrame and returns a boolean Series?
- df.find_duplicates()
- df.check_duplicates()
- df.duplicated() (Correct answer)
- df.is_duplicate()
Correct answer: df.duplicated()
df.duplicated() returns True for each row that is an exact duplicate of an earlier row.
Question 52: You have a column with values ['1,200', '3,400', '500']. Which approach correctly converts these to integers?
- df['col'].str.replace(',', '').astype(int) (Correct answer)
- df['col'].astype(int)
- df['col'].int()
- pd.to_numeric(df['col'])
Correct answer: df['col'].str.replace(',', '').astype(int)
You must strip the comma string characters before casting to int since commas are not valid numeric characters.
Question 53: What is the main advantage of using sparse PCA over standard PCA?
- Sparse PCA works only on categorical data
- Sparse PCA is faster on all datasets
- Sparse PCA always retains more variance
- Sparse PCA produces components with few non-zero loadings, improving interpretability (Correct answer)
Correct answer: Sparse PCA produces components with few non-zero loadings, improving interpretability
Sparse PCA introduces sparsity constraints so each component depends on only a few original features, aiding interpretation.
Question 54: Given the code snippet below, what will be the value of the original array `arr` after the final line is executed? ```python import numpy as np arr = np.arange(10).reshape(2, 5) arr.resize(2, 6) ```
- The `arr` array will be modified in-place to shape (2, 6), with the new elements being repeated values from the original array. (Correct answer)
- The `arr` array will be modified in-place to shape (2, 6), with the new elements being zeros.
- A new array will be returned, and `arr` will remain unchanged.
- An error will be thrown because the new size is different.
Correct answer: The `arr` array will be modified in-place to shape (2, 6), with the new elements being repeated values from the original array.
The `ndarray.resize()` method modifies the array in-place. When the new size is larger than the original, the new elements are filled by repeating the existing elements of the array. `np.reshape()`, on the other hand, would require the new shape to have the same total number of elements.
Question 55: What is the difference between `np.dot(A, B)` and `A @ B` for 2-D arrays?
- dot only works on 1-D arrays
- They are equivalent for 2-D arrays (both perform matrix multiplication) (Correct answer)
- @ is slower because it always copies data
- @ computes element-wise product; dot computes matrix product
Correct answer: They are equivalent for 2-D arrays (both perform matrix multiplication)
For 2-D arrays, `np.dot(A, B)` and `A @ B` (matmul operator) both perform matrix multiplication and give identical results.
Question 56: In Online/Mini-Batch K-Means, what is the key trade-off compared to standard K-Means?
- Automatic determination of the number of clusters
- Better cluster quality but requires more memory
- Faster convergence and lower memory usage at the cost of slightly lower cluster quality (Correct answer)
- Exact same results but with faster computation
Correct answer: Faster convergence and lower memory usage at the cost of slightly lower cluster quality
Mini-Batch K-Means uses random subsets of data per iteration, trading a small quality drop for significant speed and memory gains.
Question 57: Which pandas method converts a wide-format DataFrame to long format?
- df.unstack()
- pd.melt() (Correct answer)
- df.stack()
- pd.pivot()
Correct answer: pd.melt()
pd.melt() unpivots a DataFrame from wide to long format, turning column headers into row values.
Question 58: What is the output dtype of np.array([1, 2.0, 3])?
- int64
- object
- complex128
- float64 (Correct answer)
Correct answer: float64
NumPy upcasts the entire array to float64 because 2.0 is a float and int is a subtype of float.
Question 59: Which pandas merge type returns only rows that have matching keys in both DataFrames?
- left
- right
- outer
- inner (Correct answer)
Correct answer: inner
An inner join (how='inner') keeps only the intersection — rows whose keys exist in both DataFrames.
Question 60: What is the primary purpose of using k-fold cross-validation in machine learning?
- To provide a more robust and stable estimate of a model's performance on unseen data. (Correct answer)
- To completely eliminate the need for a final, held-out test set.
- To automatically select the best features for the model.
- To increase the speed of model training on large datasets.
Correct answer: To provide a more robust and stable estimate of a model's performance on unseen data.
K-fold cross-validation involves repeatedly training and testing a model on different subsets ('folds') of the data. By averaging the performance scores from each fold, it provides a more reliable and less biased estimate of how the model will generalize to new, independent data compared to a single train-test split.
Data Science with Python Certification
A comprehensive certification that validates proficiency in Python-based data science skills including data manipulation with Pandas/NumPy, statistical analysis, machine learning, natural language processing, and time series forecasting.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds