- Home
- Subjects
- Data Science
Data Science MCQs · Page 18
1,613 multiple choice questions with answers across 28 topics.
d = {'a': 1, 'b': 2}
print(d.pop('a'))
-
A
2
-
B
None
-
C
1
Correct answer
-
D
KeyError
-
A
Gives access to methods of the parent class
Correct answer
-
B
Creates a superclass
-
C
Calls the child constructor
-
D
Deletes the parent class
-
A
int
-
B
list
Correct answer
-
C
str
-
D
tuple of ints
print('1234'.isdigit())
-
A
False
-
B
True
Correct answer
-
C
Error
-
D
None
-
A
typeof()
-
B
instanceof()
-
C
is_a()
-
D
isinstance()
Correct answer
-
A
O(n)
-
B
O(log n)
-
C
O(1)
Correct answer
-
D
O(n log n)
-
A
The window is implicitly partitioned by ts, so each row is its own group
-
B
The function is nondeterministic and may return any row of the whole partition
-
C
The default frame ends at the current row, so the last visible value is here
Correct answer
-
D
LAST_VALUE ignores the frame and evaluates over the whole peer group
-
A
An error in most engines, since FILTER applies only to window functions here
-
B
The count of distinct status values that equal ok within the group
-
C
The number of rows whose status is ok, without needing a CASE expression
Correct answer
-
D
The total row count, with the ok rows counted twice inside the group
-
A
It undoes that work but leaves the transaction open for more statements
Correct answer
-
B
It undoes the entire transaction, exactly as a full rollback would do to it
-
C
It commits the work done before sp1 and discards everything after it
-
D
It releases the savepoint but leaves all later changes still pending
-
A
SELECT with FOR UPDATE, which holds a row lock until the transaction ends
Correct answer
-
B
Wrapping both reads in a statement with DISTINCT applied to it first
-
C
Setting the session to READ UNCOMMITTED so that writers see each other work
-
D
Adding an ORDER BY clause so the rows are processed in turn by each
-
A
Dirty reads, where uncommitted data from another transaction stays visible
-
B
Non-repeatable reads, where a re-read row shows a changed value
-
C
Lost updates, where two writers overwrite each other's committed change
-
D
Phantoms, where a re-run query returns rows inserted since the first run
Correct answer
-
A
A filter on b alone, since the optimiser can skip the leading key column
-
B
A filter on a and b, which together form the leftmost prefix of the key
Correct answer
-
C
A filter on b and c, which together cover most of the index's key
-
D
A filter on c alone, because an index is searched by any column it holds
-
A
Two, because the index allows one NULL per page of the stored data
-
B
None, because UNIQUE implies NOT NULL for every column that it covers
-
C
Any number, because two NULL values are never considered equal in SQL
Correct answer
-
D
Exactly one, because UNIQUE treats NULL like any other distinct value
-
A
The row is rejected, because NULL is not greater than zero in SQL
-
B
The row is accepted only if the column is also declared NOT NULL too
-
C
The row is rejected, since CHECK constraints treat NULL as a violation
-
D
The row is accepted, because a null check result counts as unknown
Correct answer
-
A
It updates every row of t, since the WHERE clause applies to src only
-
B
It requires a unique index on t.id, or the whole update is rolled back
-
C
If several source rows match a target row, one arbitrary value wins out
Correct answer
-
D
The statement fails whenever more than one source row matches a target row here
-
A
A temporary table holding the rejected rows for a later retry batch
-
B
The set of columns left out of the conflict target index definition
-
C
The row proposed for insertion, whose values feed the update expression
Correct answer
-
D
The row already stored, whose values are skipped by the conflict clause
-
A
The recursive term returning no new rows, which stops the iteration
Correct answer
-
B
A fixed recursion depth of 100 iterations built into every engine
-
C
The UNION ALL operator, which stops once duplicates have been seen
-
D
An explicit maximum recursion option that every recursive CTE must set
-
A
It requires both tables to have identical column order for it to work
-
B
It performs a cross join whenever the tables share no column name at all
-
C
It joins on every same-named column, so a new column silently changes it
Correct answer
-
D
It joins only on primary keys, which the optimiser may guess incorrectly
-
A
USING retains only the columns that both of the joined tables share
-
B
USING requires the join columns to carry identical names and NOT NULL
-
C
The join column appears once, so an unqualified id becomes unambiguous
Correct answer
-
D
The join column appears twice, once per table, exactly as it does with ON
-
A
It raises an error, because chi-squared scoring needs non-negative features
Correct answer
-
B
It silently takes absolute values before computing the chi-squared scores
-
C
It works but ranks the negative features last regardless of their true signal
-
D
It standardises the features first, which makes every value non-negative
-
A
The minimum and maximum, so every feature lands exactly in zero to one
-
B
The median and the standard deviation, combining robustness with spread
-
C
The median and the interquartile range, so outliers have little effect
Correct answer
-
D
The mean and the standard deviation, so outliers dominate the scaling
-
A
It stops the estimator from resetting the learned coefficients each call
-
B
It is only needed when the first batch contains fewer than two classes
-
C
The estimator must fix the label set before it can map scores to columns
Correct answer
-
D
Because partial_fit cannot infer dtypes without an explicit array given
-
A
Rows are predicted classes and columns are true classes, in label order
-
B
Rows are true classes and columns are predicted ones, ordered by frequency
-
C
Rows are predicted classes and columns are true ones, sorted by support
-
D
Rows are the true classes and columns are predicted ones, in label order
Correct answer
-
A
It accepts only predict_proba output and never a decision-function score at all
-
B
It rejects them only when the test set's classes are imbalanced
-
C
It needs continuous scores, because one threshold gives a single ROC point
Correct answer
-
D
It requires probability values that sum to one across both the classes
-
A
It shifts the first training window forward, shrinking the initial train set
-
B
It sets the minimum number of samples that each test fold must contain
-
C
It drops samples between train and test to avoid leakage from overlap
Correct answer
-
D
It adds extra folds at the end, so the test set can be scored again