- Home
- MCQs by exam
- PPSC IT
PPSC IT MCQs · Page 5
577 multiple choice questions typical of the PPSC IT exam, with answers and explanations. Switch on practice mode to test yourself first.
-
A
They are treated as unknown, so every NULL row survives in the resulting output
-
B
They abort the query, because set operators reject NULL values in any column
-
C
They are duplicated, since set operators never collapse duplicate NULLs
-
D
They are treated as equal, so the NULL row is removed from the difference
Correct answer
-
A
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, which also includes rows tied on day
Correct answer
-
B
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, counting only physical rows read
-
C
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING, which totals the whole partition
-
D
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING, a reverse running total by default
-
A
An error, because dividing two integers requires an explicit CAST in standard SQL
-
B
3, because integer division truncates; cast one operand to numeric to get 3.5
Correct answer
-
C
3.5, because SQL always performs division in floating point internally
-
D
4, because SQL rounds the exact quotient half up when both operands are ints
-
A
Every row whose email appears more than once in the table, one row per duplicate
-
B
One row per distinct email, including those that appear exactly once in users
-
C
One row per email, with the count replaced by the number of distinct duplicates
-
D
One row per duplicated email, with the number of occurrences in the count column
Correct answer
-
A
84, because a cross join returns every possible pairing of the two row sets
Correct answer
-
B
19, because a cross join appends the second table's rows directly onto the first
-
C
12, because only rows of the first table drive the result of the join
-
D
7, because the smaller table determines the number of output rows
-
A
AVG cannot appear in both the select list and the filter of the same query
-
B
The GROUP BY clause must also list AVG(salary) explicitly so the aggregate has a name
-
C
Aggregates are only permitted in the select list and in the ORDER BY clause
-
D
WHERE runs before grouping, so no aggregate exists yet; HAVING must filter instead
Correct answer
-
A
It counts every row, because COUNT ignores the NULL result of the CASE expression
-
B
It counts late rows twice, since the CASE duplicates every row that matches
-
C
It fails, because COUNT cannot accept a CASE expression as its only argument
-
D
It counts only late rows, because the CASE yields NULL for all other statuses
Correct answer
-
A
NULLIF(items, 0), which returns NULL for a zero divisor so the result becomes NULL
Correct answer
-
B
COALESCE(items, 0), which substitutes a zero divisor so that the division stays exact
-
C
NULLIF(items, 0), which replaces NULL divisors with zero and skips those rows
-
D
COALESCE(items, 0), which converts a zero divisor into a NULL before dividing
-
A
It returns the same rows as NOT EXISTS would, since NULLs are ignored by NOT IN
-
B
It raises an error, because NOT IN refuses subqueries that can produce NULL
-
C
It returns only the rows whose key is itself NULL, treating NULL as a match
-
D
It returns no rows at all, because every comparison with NULL yields unknown
Correct answer
-
A
The original column named total, since aliases are never visible to ORDER BY
-
B
A positional reference, because total is parsed as the second select expression
-
C
A re-evaluated expression, since ORDER BY recomputes price times qty again
-
D
The output column alias, which ORDER BY accepts even though WHERE does not
Correct answer
-
A
LIMIT samples rows randomly unless a repeatable seed is supplied with the statement
-
B
Without ORDER BY no row order is guaranteed, so the plan may return any ten rows
Correct answer
-
C
LIMIT is applied before the WHERE clause, so different rows qualify on each run
-
D
The table's primary key is used implicitly, and keys are regenerated on each read
-
A
Only the city column, because DISTINCT applies to the first selected expression only
-
B
Only the country column, since the last expression in the list takes precedence
-
C
Both columns independently, producing the cross product of unique values
-
D
Whole (city, country) pairs, so a city may still appear once per distinct country
Correct answer
-
A
It forms implicit groups from every selected column of the query output
-
B
It filters the single implicit group, returning either one row or no rows at all
Correct answer
-
C
It is a syntax error, because HAVING always requires an explicit GROUP BY clause
-
D
It filters individual rows before aggregation, exactly as a WHERE clause would
-
A
1.0, because balanced weighting only rescales the intercept term of the model
-
B
0.1, because the minority class is down-weighted to match the majority count
-
C
5.0, computed as n_samples divided by the product of classes and positives
Correct answer
-
D
10.0, computed as the ratio of negatives to positives in the training data
-
A
Exactly 95 components, because an integer below 1 is read as a component count
-
B
Components that individually explain at least 95% of the total variance each
-
C
95% of the original columns, chosen by their correlation with the first component
-
D
The smallest number of components whose cumulative explained variance reaches 95%
Correct answer
-
A
Only numeric columns, since passthrough drops anything it cannot encode
-
B
Encoded columns followed by every unlisted column appended unchanged in order
Correct answer
-
C
Only the encoded columns, because remainder='passthrough' keeps no other column at all
-
D
The encoded columns plus a copy of the input frame, so all columns appear twice
-
A
pipeline.set_params(model.C=0.1), using dotted attribute notation for the step
-
B
pipeline.set_params('model__C'=0.1), passing the parameter name as a quoted string
-
C
pipeline.set_params(model__C=0.1), using the step name and a double underscore
Correct answer
-
D
pipeline.set_params(C=0.1), because parameters are flattened onto the pipeline itself
-
A
StratifiedKFold with 5 splits, which preserves each class ratio inside every fold
Correct answer
-
B
KFold with 5 splits and no shuffling, which keeps the original row ordering fully intact
-
C
LeaveOneOut, because grid search always maximises the number of fitted models
-
D
TimeSeriesSplit, because f1 scoring requires chronologically ordered folds here
-
A
The score is compared with the training mean, which recentres the decision boundary
-
B
The sign of the score decides the class, with positive scores mapped to classes_[1] here
Correct answer
-
C
The score is thresholded at 0.5, exactly mirroring a probability cut-off on a calibrated model
-
D
The class with the larger absolute score wins, regardless of the score's overall sign
-
A
It fills the column with zeros, because an undefined mean is replaced by zero
-
B
It raises a ValueError, since no statistic at all can be computed from an empty column
-
C
It keeps the column and fills it with NaN, preserving the missing-value marker
-
D
It drops the column from the transformed output and ignores it during transform
Correct answer
-
A
The number of clusters tested, since n_init is simply an alias for n_clusters in the API
-
B
The number of bootstrap samples used to estimate cluster stability scores
-
C
The number of independent initialisations, with the lowest-inertia run being kept
Correct answer
-
D
The number of iterations allowed inside a single Lloyd run before it stops
-
A
It imposes an arbitrary ordinal order, which the model then treats as numeric distance
Correct answer
-
B
It fails on columns that contain more than two distinct categories at once
-
C
It returns one-hot columns, which cause perfect multicollinearity in the design matrix
-
D
It only works on the target vector, so calling it on a feature column raises an error
-
A
It sets the number of trees to the core count, overriding n_estimators entirely
-
B
It spreads independent fits over all available cores, without changing the results
Correct answer
-
C
It repeats the fit once per available core and averages the resulting forests together
-
D
It disables parallel execution, because -1 means a single worker thread here
-
A
The scaler requires the test set to be a subset of the training rows it was fitted on
-
B
Fitting on the test set leaks its statistics into preprocessing and inflates scores
Correct answer
-
C
transform must be called before fit on the training set to establish the column order
-
D
fit_transform on the test set is slower, yet returns an identical result
-
A
The confusion matrix sum, which grows whenever accuracy is artificially high
-
B
R-squared, which measures how much variance the fraud labels explain overall
-
C
Balanced accuracy, which averages recall across both classes and lands near 0.50
Correct answer
-
D
Precision, which stays high because most of the predicted negatives are truly negative