1. Home
  2. Subjects
  3. Data Science

Data Science MCQs · Page 19

1,613 multiple choice questions with answers across 28 topics.

Showing 451–475 of 1,613

StratifiedKFold is used with n_splits=5 on data where one class has only three members. What does scikit-learn do?

  1. It merges the smallest class into the largest one before splitting
  2. It warns, producing folds where that class is absent from some splits Correct answer
  3. It raises a ValueError, since each class needs at least n_splits rows
  4. It reduces n_splits automatically to the size of the smallest class
MCQSEXAM Read explanation

A pattern capturing one or more digits is applied with Series.str.extract to a column where some values do not match. What appears in those rows?

  1. NaN in the extracted column, because a non-match yields a missing value Correct answer
  2. An empty string, because extract returns the unmatched part of the input
  3. The original value unchanged, since extract only rewrites matching rows
  4. An error, because extract requires every value to match the pattern
MCQSEXAM Read explanation

SELECT city FROM a EXCEPT SELECT city FROM b; is run where both sides contain a NULL city. How are those NULLs treated?

  1. They are treated as unknown, so every NULL row survives in the resulting output
  2. They abort the query, because set operators reject NULL values in any column
  3. They are duplicated, since set operators never collapse duplicate NULLs
  4. They are treated as equal, so the NULL row is removed from the difference Correct answer
MCQSEXAM Read explanation

SUM(amount) OVER (PARTITION BY account ORDER BY day) is used as a running total. Which frame does the default produce?

  1. RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, which also includes rows tied on day Correct answer
  2. ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, counting only physical rows read
  3. RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING, which totals the whole partition
  4. ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING, a reverse running total by default
MCQSEXAM Read explanation

A query divides two integer columns as 7 / 2. What is returned, and how is a decimal result obtained?

  1. An error, because dividing two integers requires an explicit CAST in standard SQL
  2. 3, because integer division truncates; cast one operand to numeric to get 3.5 Correct answer
  3. 3.5, because SQL always performs division in floating point internally
  4. 4, because SQL rounds the exact quotient half up when both operands are ints
MCQSEXAM Read explanation

SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1; is run. What does it return?

  1. Every row whose email appears more than once in the table, one row per duplicate
  2. One row per distinct email, including those that appear exactly once in users
  3. One row per email, with the count replaced by the number of distinct duplicates
  4. One row per duplicated email, with the number of occurrences in the count column Correct answer
MCQSEXAM Read explanation