- Home
- Subjects
- Data Science
Data Science MCQs · Page 23
1,613 multiple choice questions with answers across 28 topics.
-
A
Because boolean indexing always returns a tuple of arrays, so assignment cannot tell which of the two arrays to modify in place here
-
B
Because column b does not exist in df, so pandas must decide whether to create it on the copy or on the parent frame
-
C
Boolean indexing returns a new object that may still reference the parent's data, so chained assignment has an ambiguous target
Correct answer
-
D
Because assigning a scalar to a new column is not allowed after filtering, and pandas raises a warning instead
-
A
93.33, because the denominator includes the NULL row
-
B
NULL, because any NULL makes the average unknown
-
C
90, because the NULL row is ignored in both parts
Correct answer
-
D
60, because NULL is counted as zero
-
A
Whether the subquery returns exactly one row
-
B
Whether the orders table contains a column literally named 1
-
C
Whether every customer has the same order count
-
D
Whether at least one matching order exists per customer
Correct answer
-
A
UNION sorts the output; UNION ALL reverses the sort
-
B
UNION removes duplicate rows; UNION ALL keeps every row
Correct answer
-
C
UNION keeps duplicates; UNION ALL removes them
-
D
UNION works on columns; UNION ALL only on single values
-
A
NULL is a reserved keyword and causes a syntax error
-
B
The column must be cast to text before comparison
-
C
A comparison with NULL is unknown, never true
Correct answer
-
D
NULL is treated as zero in comparisons
-
A
NULL, because the first argument is NULL
-
B
the last argument, unknown
-
C
a comma-separated list of all its arguments
-
D
the first non-NULL argument, a@b.com
Correct answer
-
A
Both assign identical numbers in every ordering
-
B
RANK skips ties and numbers all rows sequentially
-
C
ROW_NUMBER gives 2 and 3; RANK gives 2 and 2
Correct answer
-
D
ROW_NUMBER gives 2 and 2; RANK gives 2 and 3
-
A
Unmatched rows are kept with a NULL status
-
B
Unmatched rows are kept with their status set to the string 'paid'
-
C
The query returns no rows at all
-
D
The query behaves like an inner join, dropping unmatched orders
Correct answer
-
A
One row per department with the sum of salaries
-
B
One row per department with its employee count
Correct answer
-
C
One row per employee with the department name
-
D
A single row with the total employee count
-
A
Only the cities that appear exactly once
-
B
The count of customers in each city
-
C
Each city value once, with duplicates removed
Correct answer
-
D
Every customer row with the city column added
-
A
ORDER BY amount DESC
Correct answer
-
B
ORDER BY amount ASC
-
C
GROUP BY amount DESC
-
D
SORT BY amount DESC
-
A
All rows from the left table, matched or not
-
B
All rows from both tables, matched or not
-
C
Only rows that exist in the left table alone
-
D
Only rows that have a match in both tables
Correct answer
-
A
2, because it counts only the NULL entries
-
B
NULL, because aggregate functions skip the column
-
C
8, because NULL values are not counted
Correct answer
-
D
10, because it counts every row
-
A
WHERE filters groups; HAVING filters individual rows
-
B
WHERE works only with numeric columns; HAVING works with text
-
C
Both are interchangeable in every standard query
-
D
WHERE filters rows before grouping; HAVING filters groups
Correct answer
-
A
It forces the predicted probability threshold to 0.5
-
B
It weights classes inversely to their frequency
Correct answer
-
C
It duplicates minority rows until classes are equal
-
D
It removes majority rows before fitting
-
A
AUC needs ranked scores to sweep decision thresholds
Correct answer
-
B
Probability output is the only format it accepts numerically
-
C
Hard labels invert the meaning of the curve
-
D
Probabilities remove the effect of class imbalance
-
A
Whenever the model is a decision tree
-
B
Whenever the categories have no natural order
Correct answer
-
C
Whenever the categories are numeric identifiers
-
D
Whenever the column contains missing values
-
A
Uses the first combination that beats a fixed threshold
-
B
Trains and cross-validates every listed combination
Correct answer
-
C
Trains one model per parameter name, ignoring values
-
D
Samples random combinations until time runs out
-
A
It trains all steps in parallel to save wall-clock time
-
B
It automatically selects the best model among candidates
-
C
It caches the test set so it is scored only once
-
D
Cross-validation refits the steps on each training fold
Correct answer
-
A
A single score computed on the full dataset
-
B
Five fitted model objects returned for reuse
-
C
The best hyperparameter values found during the parameter search
-
D
Five scores, one per fold, from rotating validation splits
Correct answer
-
A
fit_transform returns a sparse matrix while transform does not
-
B
Fitting twice causes the scaler to forget its parameters
-
C
Fitting on test data leaks its statistics into training
Correct answer
-
D
transform is the only method that accepts two arguments
-
A
The maximum depth allowed for each tree
-
B
The number of features considered at each split
-
C
The fraction of samples drawn for bootstrapping
-
D
The number of decision trees in the ensemble
Correct answer
-
A
The average probability that the model assigned to the correct class
-
B
The area under the receiver operating curve
-
C
The mean squared difference between labels
-
D
The fraction of predictions that match the true labels
Correct answer
-
A
Replaces values with their rank within the column
-
B
Applies a logarithm to compress large values
-
C
Subtracts the mean and divides by the standard deviation
Correct answer
-
D
Rescales every value into the closed interval from zero to one
-
A
To scale features so they share a common range
-
B
To select the most important features from the data automatically
-
C
To merge several datasets into one training set
-
D
To hold out data for an unbiased estimate of generalisation
Correct answer