← All Data Science with Python Certification Flashcard Decks

Mixed Deck — All Data Science with Python Certification Topics Flashcards

100 cards from real Data Science with Python Certification practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 20 Mixed Deck — All Data Science with Python Certification Topics flashcards as text
  1. What is the result of `bool([])` in Python?

    Answer: False

    An empty list is falsy in Python, so `bool([])` evaluates to `False`.

  2. Which pandas function computes pairwise correlation between all numeric columns?

    Answer: df.corr()

    df.corr() returns a DataFrame of pairwise Pearson (or other) correlation coefficients between all numeric columns.

  3. What is a Type I error in hypothesis testing?

    Answer: Rejecting a true null hypothesis

    A Type I error (false positive) occurs when the test incorrectly rejects a true null hypothesis.

  4. Which scikit-learn class is used to split data into training and test sets?

    Answer: sklearn.model_selection.train_test_split

    train_test_split from sklearn.model_selection randomly partitions arrays or matrices into train and test subsets.

  5. In a Support Vector Machine (SVM) model, what is the primary purpose of the 'kernel trick'?

    Answer: To efficiently compute dot products in a high-dimensional feature space without explicitly mapping the data, allowing the model to find non-linear decision boundaries.

    The kernel trick is a core concept in SVMs that allows them to solve non-linear classification problems. It works by implicitly mapping the input data into a higher-dimensional space where a linear separator can be found. The 'trick' is that it achieves this without ever having to compute the coordinates of the data in that high-dimensional space, instead calculating the dot products directly in the original space, which is computationally efficient.

  6. 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?

    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.

  7. The K-Nearest Neighbors (KNN) algorithm is often referred to as a 'lazy learner'. Why is this designation used?

    Answer: It does not learn a discriminative function from the training data but instead memorizes the entire training dataset.

    KNN is called a 'lazy learner' or an instance-based learner because it doesn't have a distinct training phase where it learns a model. Instead, it stores, or memorizes, the entire training dataset. All the computation, such as calculating distances to find the nearest neighbors, is deferred until a prediction is requested for a new data point.

  8. Which method fills missing values in a time series by estimating between known points?

    Answer: df.interpolate(method='linear')

    `df.interpolate(method='linear')` fills missing values by fitting a straight line between surrounding known data points.

  9. Which of the following is a key assumption of Linear Regression that, if violated, can lead to unreliable and biased coefficient estimates?

    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.

  10. What qualifies as not a property of an ndarray object?

    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.

  11. What is the interquartile range (IQR) commonly used for in data science?

    Answer: Measuring the spread of the middle 50% of data

    IQR is the difference between Q3 and Q1, capturing the spread of the central 50% of data and is used for outlier detection.

  12. How do you shift a pandas time series forward by one period to create a lagged feature?

    Answer: df.shift(1)

    `df.shift(1)` moves all values forward by one period, inserting NaN at the start — a standard way to create lag features.

  13. 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?

    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.

  14. How do you parse a date column automatically when reading a CSV file with pandas?

    Answer: pd.read_csv(file, parse_dates=['date'])

    The `parse_dates` parameter in `pd.read_csv()` automatically converts specified columns to pandas datetime objects.

  15. In the context of a binary classification model, which of the following statements best describes the bias-variance tradeoff?

    Answer: Increasing model complexity typically decreases bias but increases variance.

    The bias-variance tradeoff is a fundamental concept where bias represents errors from overly simplistic assumptions (underfitting), and variance represents errors from being too sensitive to the training data (overfitting). As a model's complexity increases, its ability to fit the training data improves, thus decreasing bias. However, this increased complexity makes it more likely to model the noise in the training data, thus increasing its variance.

  16. 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?

    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.

  17. What is the difference between stemming and lemmatization in NLP?

    Answer: Stemming crudely chops suffixes while lemmatization returns a valid dictionary base form

    Stemming applies heuristic suffix stripping (e.g., 'running' → 'run'), while lemmatization uses morphological analysis to return the proper dictionary form.

  18. Which Matplotlib method changes the x-axis tick labels?

    Answer: ax.set_xticklabels()

    ax.set_xticklabels() sets the text labels for the x-axis tick marks.

  19. In DBSCAN, what is a 'border point'?

    Answer: A point within epsilon of a core point but not itself a core point

    A border point is reachable from a core point but has fewer than MinPts neighbors within epsilon.

  20. Which NumPy function stacks arrays vertically (row-wise)?

    Answer: np.vstack

    np.vstack stacks a sequence of arrays along the first (vertical) axis, equivalent to concatenate with axis=0.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy