Home
MCQs by exam
PPSC IT
PPSC IT MCQs · Page 9
577 multiple choice questions typical of the PPSC IT exam, with answers and explanations. Switch on practice mode to test yourself first.
A
CAST(order_date AS TEXT) LIKE '2024%', which cannot use the index
B
order_date + INTERVAL '1 day' = '2024-06-01', a computed date
C
order_date >= '2024-01-01' AND order_date < '2025-01-01'
Correct answer
D
EXTRACT(YEAR FROM order_date) = 2024, which scans every row
A
TRUNCATE accepts a WHERE clause but is slower than DELETE, because it scans the whole table row by row
B
Both fire row-level triggers once per removed row, so auditing behaves exactly the same for the two statements here
C
DELETE cannot be rolled back in any database, while TRUNCATE always can, because it is DDL and not DML
D
TRUNCATE removes all rows in one operation, cannot take a WHERE clause and fires no row-level delete triggers
Correct answer
A
The store's average sales, with 0 substituted wherever the partition is empty or has one row
B
The next month's sales within the same store, with 0 substituted for the last row of each partition
C
The running total of sales within each store, starting at 0 at the very first row of every partition here
D
The previous month's sales within the same store, with 0 substituted for the first row of each partition
Correct answer
A
Because NOT IN converts the NULL to zero and then compares numerically, matching every zero value
B
Because x <> NULL is UNKNOWN, so the NOT IN predicate can never be TRUE; NOT EXISTS is null-safe
Correct answer
C
Because the subquery is executed only when it contains no NULL values, and otherwise the whole subquery is skipped
D
Because NOT IN is not valid with a subquery at all, so the parser rejects the statement outright
A
UNION removes duplicate rows and therefore usually needs a sort or hash, while UNION ALL concatenates and keeps duplicates
Correct answer
B
Both remove duplicate rows, differing only in the column ordering they produce, so the choice between them is purely cosmetic
C
UNION requires matching column names, while UNION ALL does not, which is why UNION ALL is faster to write
D
UNION ALL removes duplicate rows, while UNION keeps them, so the two operators are exact opposites in effect
A
20, because the median of the three values is used instead of the mean
B
NULL, because any NULL in the input makes the aggregate NULL
C
15, because the NULL is excluded from both the sum and the count
Correct answer
D
10, because the NULL is treated as a zero value in the average
A
The rows are excluded from the result entirely, because the grouping key is missing
B
The query fails unless NULLs are filtered out first, since grouping needs a known key
C
All NULLs form a single group, because GROUP BY treats them as equal to each other
Correct answer
D
Each NULL forms its own separate group, because NULL is never equal to another one
A
Because COUNT(*) ignores NULLs in the customer key, so rows with a missing key are never counted at all by the aggregate
B
The one-to-many join repeats each customer row per order, so COUNT(DISTINCT customer_id) or a subquery gives the true count
Correct answer
C
Because the join sorts the rows and duplicates them during the sort, so the sort key must therefore be made distinct first of all
D
Because COUNT(*) counts columns rather than rows, so it returns the width of the joined result instead of its height
A
It includes them only if the column is indexed, since the index stores a default value
B
It includes them, because NULL differs from every value including the string x
C
It excludes them, because NULL <> 'x' evaluates to UNKNOWN rather than TRUE
Correct answer
D
It raises an error unless col is declared NOT NULL, because the comparison is invalid
A
Nothing changes, because the optimiser moves the predicate into the ON clause
B
All inactive matches are kept while unmatched rows are duplicated
C
The query fails because WHERE cannot reference the right table
D
Rows with no matching b row are removed, turning the outer join into an effective inner join
Correct answer
A
1,2,3 for all three functions, because every row receives a distinct sequential position
B
1,1,2 for RANK and 1,1,3 for DENSE_RANK, with 1,2,3 for ROW_NUMBER in the very same single query
C
1,1,3 for RANK; 1,1,2 for DENSE_RANK; and 1,2,3 for ROW_NUMBER with an arbitrary tie order
Correct answer
D
1,1,3 for all three, since ties always skip a position whatever function is used
A
RANGE requires a PARTITION BY clause, whereas ROWS can be used over the whole table without one
B
ROWS ignores the ORDER BY, whereas RANGE sorts the partition before summing
C
Rows that tie on d are all included in the same running total under RANGE, while ROWS admits them one at a time
Correct answer
D
RANGE includes only the current row, whereas ROWS accumulates every preceding row in the partition
A
10 and 7
Correct answer
B
7 and 7
C
10 and 10
D
7 and 10
A
The precision-recall curve, which plots precision against recall at every threshold
B
The validation curve, which plots scores against one hyperparameter value at a time
C
The ROC curve, which plots the true positive rate against the false positive rate of the model
D
The learning curve, which plots training and validation scores against training-set size
Correct answer
A
step1 and step2, numbered in order
B
scaler and clf, fixed default aliases
C
It raises an error, because make_pipeline requires explicit names
D
standardscaler and logisticregression, the lowercased class names
Correct answer
A
It multiplies each row's contribution to the loss by its weight, without resampling the data
Correct answer
B
It sorts the rows so that heavier samples are fitted first and influence the coefficients more
C
It affects only predict, not the fitted coefficients, which are always learned unweighted
D
It physically replicates rows in proportion to their weights before the fit begins to run
A
max_features must equal the total number of features, so that every split always sees the whole feature set
B
The number of trees must be less than the number of samples, so that every tree sees fresh data
C
criterion must be set to entropy, because the Gini criterion cannot track the out-of-bag error
D
bootstrap=True, since out-of-bag samples exist only when each tree is trained on a bootstrap resample
Correct answer
A
It maps the unseen category to the first known category
B
It encodes that row as all zeros instead of raising an error
Correct answer
C
It adds a new column for the unseen category automatically
D
It raises an error, since ignore only downgrades the error to a warning
A
predict_proba returns normalised class probabilities summing to one, while decision_function returns unbounded signed distances to the decision boundary
Correct answer
B
decision_function returns probabilities between zero and one, while predict_proba returns raw margins, so the two names are swapped in most of the documentation
C
Both return probabilities, but predict_proba is only for regressors while decision_function is only for classifiers, so neither applies here
D
predict_proba is available on every estimator, while decision_function is not, which is why predict_proba is the preferred interface for scoring
A
It requires a separate hold-out set and raises NotFittedError when none is supplied alongside cv
B
The predictions are out-of-fold, but the same folds would also drive selection, so the resulting score is not a clean estimate
Correct answer
C
cross_val_predict refits on the full dataset first, so every prediction is in-sample and therefore over-optimistic
D
It returns one aggregate score per fold instead of predictions, so accuracy cannot be computed from its output
A
The estimator fitted on the first fold only
B
An ensemble average of all candidate estimators
C
It raises NotFittedError because refit must be False before predict
D
The best estimator refitted on the full training set, not just the winning fold
Correct answer
A
Because without centring the transformed features are always positive and therefore easier to interpret
B
Because with_mean=False switches to median and interquartile scaling instead of the ordinary mean
C
Centring would densify a sparse matrix, so scaling by the standard deviation alone preserves sparsity
Correct answer
D
Sparse matrices cannot be divided by a scalar, so only centring is available for them in practice
A
The training and test sets keep approximately the same class proportions as the full dataset
Correct answer
B
Only samples with non-missing labels are used, and rows with NaN labels are dropped
C
Each class appears exactly once in the test set, regardless of how many samples it has
D
The split is reproducible without setting random_state, because stratification fixes the seed
A
Pipeline refits the scaler on every validation fold to check stability across the splits
B
The pipeline scales the whole dataset once before splitting, which is equivalent and faster
C
During each fold, fit runs on the training part only and transform is applied to the held-out part
Correct answer
D
Pipeline disables scaling during cross-validation entirely, so the scaler only runs on the final fit
A
LeaveOneOut, giving one fold per sample and a very large number of separate fits
B
ShuffleSplit with a fixed random seed and a single random shuffle per call
C
StratifiedKFold with five splits, preserving class proportions in each fold
Correct answer
D
Plain KFold with ten splits, ignoring the class labels of the samples entirely
Practise on paper
Preparing for PPSC IT?
Make it your exam plan: see your progress in every subject and topic, set a daily goal and practise what you have not done yet.
Start my PPSC IT plan
Test yourself
Take a timed online test and get a certificate, or play today's quick quiz.
Online tests
Daily quiz