Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with explanations.
Choose an option to check your answer.
A.
Tied rows receive the same rank and subsequent rank numbers contain gaps
B.
Every row receives a unique consecutive rank
C.
Tied rows are removed
D.
All following ranks become NULL
Show Answer
Correct Answer: A. Tied rows receive the same rank and subsequent rank numbers contain gaps
Explanation:
RANK assigns equal positions to ties.
The next rank reflects the number of preceding rows, which creates gaps.
Choose an option to check your answer.
A.
RANK
B.
DENSE_RANK
C.
COUNT DISTINCT
D.
ROW_NUMBER
Show Answer
Correct Answer: D. ROW_NUMBER
Explanation:
ROW_NUMBER gives every row a different sequence value according to the specified order.
Tied sort values still receive different row numbers.
Choose an option to check your answer.
A.
Collapses each group into one result row
B.
Physically partitions the database table
C.
Divides rows into independent groups while retaining individual rows
D.
Filters out rows before the query runs
Show Answer
Correct Answer: C. Divides rows into independent groups while retaining individual rows
Explanation:
Window partitions define the peer group over which a calculation operates.
Unlike GROUP BY, window functions preserve row-level output.
Choose an option to check your answer.
A.
Only one grand total
B.
Aggregations for all combinations of the specified grouping columns
C.
Only the most detailed group
D.
A multidimensional SSAS database file
Show Answer
Correct Answer: B. Aggregations for all combinations of the specified grouping columns
Explanation:
CUBE returns every subtotal combination across the listed dimensions.
It can produce many groups, so designers should consider result size.
Choose an option to check your answer.
A.
Hierarchical subtotals following the order of grouping columns plus a grand total
B.
Every possible combination of grouping columns
C.
Only detail rows with no totals
D.
A ranking column for each row
Show Answer
Correct Answer: A. Hierarchical subtotals following the order of grouping columns plus a grand total
Explanation:
ROLLUP follows a hierarchy from detailed groups toward higher-level totals.
Column order determines which subtotal levels are generated.
Choose an option to check your answer.
A.
Create dimension surrogate keys
B.
Store query results permanently
C.
Apply row-level security
D.
Return multiple specified aggregation levels in one grouped query
Show Answer
Correct Answer: D. Return multiple specified aggregation levels in one grouped query
Explanation:
GROUPING SETS allow several group combinations without separate UNION queries.
They can produce totals by region, product, and overall in one statement.
Choose an option to check your answer.
A.
It treats every NULL as zero automatically
B.
It raises an error whenever a NULL exists
C.
It excludes NULL values from both the numerator and count
D.
It converts NULL to the group maximum
Show Answer
Correct Answer: C. It excludes NULL values from both the numerator and count
Explanation:
AVG computes the sum of non-NULL values divided by their non-NULL count.
Replacing NULL with zero changes the business meaning and must be deliberate.
Choose an option to check your answer.
A.
COUNT(SalesAmount)
B.
SUM(SalesAmount)
C.
MIN(SalesAmount)
D.
ROW_NUMBER(SalesAmount)
Show Answer
Correct Answer: B. SUM(SalesAmount)
Explanation:
SUM adds additive measure values across the selected group.
It is appropriate when each fact row contributes an amount to the total.
Choose an option to check your answer.
A.
COUNT(DISTINCT CustomerKey)
B.
COUNT(*)
C.
SUM(CustomerKey)
D.
AVG(CustomerKey)
Show Answer
Correct Answer: A. COUNT(DISTINCT CustomerKey)
Explanation:
COUNT DISTINCT removes repeated customer keys before counting.
COUNT(*) would count order rows rather than unique customers.
Choose an option to check your answer.
A.
HAVING cannot contain dates
B.
WHERE automatically creates an index
C.
HAVING changes the fact-table grain
D.
WHERE reduces input rows before aggregation and expresses the intended logic
Show Answer
Correct Answer: D. WHERE reduces input rows before aggregation and expresses the intended logic
Explanation:
Filtering early reduces the data that must be joined and aggregated.
It also distinguishes row predicates from conditions on aggregate groups.
Choose an option to check your answer.
A.
WHERE
B.
ORDER BY
C.
HAVING
D.
JOIN
Show Answer
Correct Answer: C. HAVING
Explanation:
HAVING applies conditions to grouped results such as SUM or COUNT.
WHERE filters individual rows before grouping occurs.
Choose an option to check your answer.
A.
Sort rows without calculating totals
B.
Aggregate rows that share selected dimension values
C.
Filter groups after aggregation only
D.
Create a physical index
Show Answer
Correct Answer: B. Aggregate rows that share selected dimension values
Explanation:
GROUP BY partitions detail rows into logical groups for aggregate functions.
It is commonly used to summarize facts by dimensions such as month or region.