Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with explanations.
Choose an option to check your answer.
A.
It can reduce the cost of locating and matching rows between tables
B.
It changes nonadditive measures into additive measures
C.
It removes the need for join conditions
D.
It guarantees a nested-loops join is always best
Show Answer
Correct Answer: A. It can reduce the cost of locating and matching rows between tables
Explanation:
Indexes can support efficient probes, ordering, or reduced scans on join columns.
The optimizer still chooses the join algorithm based on row counts and costs.
Choose an option to check your answer.
A.
Moving report filters to the bottom of a dashboard
B.
Delaying all filters until after aggregation
C.
Copying every source row into memory
D.
Applying filters as close to the data source or scan as possible to reduce rows processed
Show Answer
Correct Answer: D. Applying filters as close to the data source or scan as possible to reduce rows processed
Explanation:
Early filtering reduces I/O, transfer, join inputs, and aggregation work.
Modern engines may push predicates into scans, remote sources, or storage segments.
Choose an option to check your answer.
A.
YEAR(OrderDate) = 2026
B.
CONVERT(varchar, OrderDate) LIKE '2026%'
C.
OrderDate >= @StartDate AND OrderDate < @EndDate
D.
OrderDate + 0 = @Date
Show Answer
Correct Answer: C. OrderDate >= @StartDate AND OrderDate < @EndDate
Explanation:
A sargable predicate leaves the indexed column unwrapped so the engine can seek a range.
Applying functions to the column often prevents efficient index navigation.
Choose an option to check your answer.
A.
To change the business definition of a measure
B.
To understand chosen access methods, joins, estimates, and expensive operators
C.
To modify source transactions
D.
To design dashboard navigation
Show Answer
Correct Answer: B. To understand chosen access methods, joins, estimates, and expensive operators
Explanation:
The plan shows how the optimizer intends to execute the SQL statement.
It helps identify scans, bad estimates, spills, and missing access paths.
Choose an option to check your answer.
A.
The expression value from the first row of the defined ordered frame
B.
The smallest value regardless of ordering
C.
The first physical row stored on disk
D.
A unique key generated by SQL Server
Show Answer
Correct Answer: A. The expression value from the first row of the defined ordered frame
Explanation:
FIRST_VALUE follows the window ordering and frame definition.
It can repeat a baseline value across rows for comparison.
Choose an option to check your answer.
A.
Returns the fourth row only
B.
Calculates four different totals
C.
Removes every fourth row
D.
Assigns rows as evenly as possible to four numbered buckets
Show Answer
Correct Answer: D. Assigns rows as evenly as possible to four numbered buckets
Explanation:
NTILE divides ordered rows into a requested number of groups.
It is often used for quartiles, deciles, and customer segmentation.
Choose an option to check your answer.
A.
Divide sales by ROW_NUMBER()
B.
Use COUNT(*) as the denominator
C.
Divide regional sales by SUM(regional sales) OVER ()
D.
Apply DISTINCT to the sales amount
Show Answer
Correct Answer: C. Divide regional sales by SUM(regional sales) OVER ()
Explanation:
A window SUM over all result rows supplies the denominator while retaining each region.
The regional amount divided by that total yields its share.
Choose an option to check your answer.
A.
A grand total over the entire table
B.
A frame containing the current row and two preceding monthly rows
C.
A unique clustered index on month name
D.
A GROUP BY with no date column
Show Answer
Correct Answer: B. A frame containing the current row and two preceding monthly rows
Explanation:
A bounded window frame computes the average over a sliding set of periods.
As the current row changes, the three-row frame moves with it.
Choose an option to check your answer.
A.
SUM(Amount) OVER (ORDER BY Date ROWS UNBOUNDED PRECEDING)
B.
SUM(Amount) without an OVER clause
C.
COUNT(*) GROUP BY Date only
D.
MAX(Amount) OVER ()
Show Answer
Correct Answer: A. SUM(Amount) OVER (ORDER BY Date ROWS UNBOUNDED PRECEDING)
Explanation:
A cumulative frame from the first row through the current row produces a running total.
The ORDER BY defines the sequence in which values accumulate.
Choose an option to check your answer.
A.
LAG
B.
SUM
C.
GROUPING
D.
LEAD
Show Answer
Correct Answer: D. LEAD
Explanation:
LEAD accesses a later row within the ordered partition.
It can compare a current value with the next period or milestone.
Choose an option to check your answer.
A.
LEAD
B.
NTILE
C.
LAG
D.
CUME_DIST
Show Answer
Correct Answer: C. LAG
Explanation:
LAG accesses an earlier row without a self-join.
It is useful for period-over-period differences and change detection.
Choose an option to check your answer.
A.
It never allows tied ranks
B.
It gives ties the same rank without leaving gaps afterward
C.
It ranks only numeric columns
D.
It collapses all rows into one group
Show Answer
Correct Answer: B. It gives ties the same rank without leaving gaps afterward
Explanation:
DENSE_RANK advances by one distinct ordered value.
Therefore the rank sequence remains consecutive after ties.