FreeExam

Data analyst: SQL and Temporal Analysis

Original technical interview scenarios on query grain, joins, NULL semantics, aggregate and window behavior, historical validity, event and ingestion time, cohorts, exposure denominators, late corrections, and reproducible analysis. Query-specific examples identify SQLite explicitly.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.SQLite: users(id) has 1,2. Events(user,id) has (1,10),(1,11). After users LEFT JOIN events ON users.id=events.user, what are COUNT(*) and COUNT(events.id)?

    Show answer and explanation
    1. 2 and 0
    2. 3 and 3
    3. 2 and 2
    4. 3 and 2

    Answer: 3 and 2

    User one produces two matches; user two produces one null-extended row. COUNT(*) counts all three result rows, while COUNT(events.id) counts the two non-NULL event IDs.

  2. 2.An order has item amounts six and nine, and three payment rows. SQL joins items to payments on that order, then sums item amounts. What sum results from that joined row set?

    Show answer and explanation
    1. 15
    2. 18
    3. 90
    4. 45

    Answer: 45

    Each of the two items appears once per payment, yielding three copies of each amount. The sum is 3×(6+9)=45. Aggregate each side to the intended grain before combining when that matches the target.

  3. 3.SQLite: two distinct orders each have amount 20. An analyst uses SUM(DISTINCT amount) to protect an order-total report from duplicate joins. What does that expression return even before any duplicate join?

    Show answer and explanation
    1. 40
    2. 0
    3. 20
    4. 2

    Answer: 20

    DISTINCT applies to the numeric amount, not the order identity. The two equal amounts collapse to one value, losing a legitimate order. Correct the relationship/grain rather than deduplicate monetary values as a proxy for entities.

  4. 4.SQLite: events(user) contains 7,7,NULL,8. What does COUNT(DISTINCT user) return?

    Show answer and explanation
    1. 3
    2. 1
    3. 4
    4. 2

    Answer: 2

    COUNT(DISTINCT user) counts distinct non-NULL values: seven and eight. It neither counts the repeated seven twice nor treats NULL as an additional counted user.

  5. 5.SQLite: x(v) has values 2,0,NULL. What are AVG(v) and COUNT(v)?

    Show answer and explanation
    1. 2 and 1
    2. 1 and 2
    3. 1 and 3
    4. 2/3 and 3

    Answer: 1 and 2

    AVG ignores the NULL and averages two and zero, giving one. COUNT(v) likewise counts the two non-NULL values. The physical row count would be three.

  6. 6.SQLite: x(v) has no rows. SELECT COUNT(*), SUM(v) FROM x has no GROUP BY. What single row is returned?

    Show answer and explanation
    1. NULL and NULL
    2. No result row
    3. 0 and NULL
    4. 0 and 0

    Answer: 0 and NULL

    An aggregate query without GROUP BY still returns an aggregate row for empty input. COUNT is zero; SUM is NULL. Converting the sum to zero requires an explicit policy such as COALESCE, appropriate to the metric.

  7. 7.SQLite: x(k,v) has (NULL,2),(NULL,3),('a',4). How many groups does GROUP BY k produce, and what is the NULL-key group's SUM(v)?

    Show answer and explanation
    1. 2 groups; sum 5
    2. 1 group; sum 9
    3. 3 groups; sum 2
    4. 2 groups; sum NULL

    Answer: 2 groups; sum 5

    GROUP BY places the two NULL keys in the same group, whose values sum to five. The 'a' key forms a second group. This grouping behavior differs from a normal equality predicate comparing NULL values.

  8. 8.SQLite: rows are (team,v)=('a',1),('a',2),('b',5). SELECT team,SUM(v) FROM x GROUP BY team HAVING COUNT(*)>1 returns which team and sum?

    Show answer and explanation
    1. b and 5
    2. Both a and b
    3. a and 2
    4. a and 3

    Answer: a and 3

    HAVING filters groups after aggregation. Team a has two rows and sum three; team b has one row and fails the count condition. Filtering individual values before grouping would be a different query.

  9. 9.SQLite: three rows have flags 1,0,NULL. What does COUNT(CASE WHEN flag=1 THEN 1 ELSE 0 END) return?

    Show answer and explanation
    1. 1
    2. 2
    3. NULL
    4. 3

    Answer: 3

    The CASE yields 1,0,0, all non-NULL, so COUNT counts three. To count only true flags, use an appropriate conditional SUM, COUNT with a NULL nonmatch, or FILTER; a zero is still a counted value.

  10. 10.SQLite: x(v) contains 1,2,NULL,4. What does SUM(v) FILTER (WHERE v>1) return?

    Show answer and explanation
    1. 7
    2. 2
    3. 6
    4. NULL

    Answer: 6

    The filter includes two and four, so their sum is six. One fails the predicate; NULL does not make it true. FILTER restricts inputs to this aggregate rather than changing unrelated aggregates automatically.

  11. 11.SQLite: users(id) contains 1,2,3 and banned(id) contains 2,NULL. Which user IDs survive WHERE id NOT IN (SELECT id FROM banned)?

    Show answer and explanation
    1. None
    2. 2 only
    3. 1,2,3
    4. 1 and 3

    Answer: None

    Two is a definite match and fails NOT IN. For one and three, the NULL in the subquery prevents a true nonmembership result. WHERE keeps only true predicates, so no users survive.

  12. 12.SQLite: users(id) contains 1,2,3 and banned(id) contains 2,NULL. Which IDs survive WHERE NOT EXISTS (SELECT 1 FROM banned b WHERE b.id=users.id), ordered by id?

    Show answer and explanation
    1. 2 only
    2. 1 and 3
    3. None
    4. 1,2,3

    Answer: 1 and 3

    Only user two has a matching equality row. A NULL banned ID does not equal any of these non-NULL user IDs, so it does not poison this correlated existence check as it would a NOT IN list.

  13. 13.SQLite: what values do SELECT NULL=NULL, NULL IS NULL return?

    Show answer and explanation
    1. 0 and 1
    2. 1 and 1
    3. NULL and 1
    4. NULL and NULL

    Answer: NULL and 1

    Ordinary equality with NULL yields NULL, representing an unknown comparison. IS NULL tests nullness and returns true, encoded as one. Use the predicate matching the intended missing-value semantics.

  14. 14.SQLite: measurements(v) contains 10,NULL. What are AVG(v) and AVG(COALESCE(v,0))?

    Show answer and explanation
    1. 5 and 5
    2. 10 and 5
    3. NULL and 0
    4. 10 and 10

    Answer: 10 and 5

    The first average uses only the known ten. The second replaces the missing value with zero and averages two numbers. This arithmetic is valid SQL but the replacement asserts a substantive measurement policy.

  15. 15.SQLite: what are 5/2 and 5/2.0 in a SELECT expression?

    Show answer and explanation
    1. 2 and 2
    2. An error and 2.5
    3. 2 and 2.5
    4. 2.5 and 2.5

    Answer: 2 and 2.5

    Integer operands use integer division here, giving two. A real operand makes the second division floating point. Cast or use a real operand deliberately when forming rates rather than assume every SQL dialect has the same rule.

  16. 16.SQLite: a(v) contains 1,1 and b(v) contains 1,2. What are the row counts of a UNION b and a UNION ALL b?

    Show answer and explanation
    1. 4 and 4
    2. 3 and 4
    3. 2 and 4
    4. 2 and 3

    Answer: 2 and 4

    UNION removes duplicate result rows, leaving one and two. UNION ALL preserves all four input rows. Choose based on the intended entity/event semantics; set union is not a generic replacement for identity-based deduplication.

  17. 17.SQLite: a(v) contains 1,1,2,3 and b(v) contains 2,4. What values does SELECT v FROM a EXCEPT SELECT v FROM b return, ordered by v?

    Show answer and explanation
    1. 2
    2. 1,2,3,4
    3. 1,1,3
    4. 1 and 3

    Answer: 1 and 3

    EXCEPT returns distinct left-side rows absent on the right. Two is removed and duplicate ones collapse, so one and three remain. It is a set difference, not a count-preserving event subtraction.

  18. 18.SQLite: SELECT NULL UNION SELECT NULL produces how many result rows?

    Show answer and explanation
    1. 1
    2. An error
    3. 0
    4. 2

    Answer: 1

    Compound UNION duplicate removal treats these NULL result rows as duplicates. That is distinct from the unknown result of NULL=NULL in an ordinary expression; SQL operations need their own stated semantics.

  19. 19.SQLite: x(id,a,b,c) has (1,1,0,0),(2,0,1,0),(3,0,1,1). WHERE a=1 OR b=1 AND c=1 returns which IDs?

    Show answer and explanation
    1. 1,2,3
    2. 3 only
    3. 2 and 3
    4. 1 and 3

    Answer: 1 and 3

    AND binds more tightly than OR, so the predicate is a=1 OR (b=1 AND c=1). Row one qualifies through a and row three through b and c. Use parentheses when the intended rule differs.

  20. 20.SQLite: x(k) contains 'A','a','b'. With GROUP BY k COLLATE NOCASE and these ASCII values, how many groups result?

    Show answer and explanation
    1. 2
    2. 3
    3. 0
    4. 1

    Answer: 2

    NOCASE groups 'A' and 'a' together for these ASCII keys; 'b' is separate. This explicitly chosen collation is part of key semantics, not proof that every Unicode form or business identifier is interchangeable.

  21. 21.SQLite: users 1,2 have orders (user,status)=(1,'closed'). To retain both users but attach only open orders, where should the status predicate go in a LEFT JOIN?

    Show answer and explanation
    1. In ON with the user-key equality
    2. Replace LEFT JOIN with INNER JOIN and keep the predicate
    3. In HAVING without grouping or another change
    4. In WHERE as orders.status='open'

    Answer: In ON with the user-key equality

    An ON restriction limits right-side matches while preserving unmatched users. A WHERE equality on the right status rejects NULL-extended rows, so it removes users without an open match.

  22. 22.SQLite: x(id,flag) contains (1,0),(2,1),(3,NULL). Which IDs survive WHERE NOT(flag=1), ordered by id?

    Show answer and explanation
    1. 1 and 3
    2. 2 only
    3. 1 only
    4. 1,2,3

    Answer: 1 only

    For NULL, flag=1 is unknown and its negation remains unknown. WHERE keeps true results, so only the known zero survives. Include missing flags explicitly if that matches the business rule.

  23. 23.A report joins orders to a supposedly unique customer key. Each order must appear once. What source check directly tests that join assumption?

    Show answer and explanation
    1. Find customer keys with COUNT(*)>1 at the join-key grain.
    2. Check only that customer IDs are unique within each import batch, ignoring retained batches.
    3. Compare table row counts and assume the smaller table is unique on every key.
    4. Check that each customer display name is nonempty and infer key uniqueness.

    Answer: Find customer keys with COUNT(*)>1 at the join-key grain.

    A many-to-one join requires at most one matching customer row per key. Audit or constrain that exact key, including any tenant or version scope. Table size and nonempty display names do not establish uniqueness.

  24. 24.Two tenants each have order ID 1. Items contain one row for tenant A/order 1 and two for B/order 1. Joining both orders to items using only order ID produces how many rows, versus joining on tenant and order ID?

    Show answer and explanation
    1. 2 versus 3
    2. 3 versus 3
    3. 6 versus 3
    4. 6 versus 6

    Answer: 6 versus 3

    The incomplete join key lets each of two orders match all three items, producing six rows. Including tenant gives one A match and two B matches, totaling three. Identity scope belongs in the relationship.

  25. 25.One event worth twelve units is attributed through a bridge with weights 0.25 and 0.75 for two channels. What total does summing amount×weight across its two bridge rows preserve?

    Show answer and explanation
    1. 24
    2. 6
    3. 12
    4. 9

    Answer: 12

    The contributions are three and nine, summing to twelve. This preserves the total because the event's allocation weights sum to one. Unweighted duplication would count twenty-four and change the attribution semantics.

  26. 26.Three users have respectively two, zero, and three purchase rows. The target is users with any purchase, each counted once. Which SQL pattern directly expresses that membership?

    Show answer and explanation
    1. Count distinct purchase IDs and label the result distinct purchasing users.
    2. Filter users with a correlated EXISTS purchase check.
    3. Join all purchases and count matching rows, treating each transaction as a separate qualifying user.
    4. Select users with exactly one purchase and omit repeat purchasers from the membership target.

    Answer: Filter users with a correlated EXISTS purchase check.

    EXISTS expresses presence without emitting one user row per purchase. The target count is two users, while a raw matching join has five purchase-level rows. Choose entity membership rather than accidental multiplicity.

  27. 27.A LEFT JOIN can match a right row whose nullable comment is NULL. An anti-join then filters WHERE right.comment IS NULL. What error can this create?

    Show answer and explanation
    1. A matched row with a NULL comment can look unmatched.
    2. Every matched comment is automatically converted to an empty string.
    3. The filter is always equivalent to NOT EXISTS on the join predicate.
    4. NULL comments make the join return no rows at all.

    Answer: A matched row with a NULL comment can look unmatched.

    Use a guaranteed non-NULL matched marker or a suitable NOT EXISTS predicate. A nullable attribute does not reliably distinguish a real matching row from a null-extended unmatched row.

  28. 28.A SQL report uses LIMIT 10 with no ORDER BY and calls the output the ten earliest events. No physical-order contract is supplied. What is missing?

    Show answer and explanation
    1. An explicit earliest-first ordering with a tie rule
    2. Assume an event-time index guarantees the required output order without an ORDER BY.
    3. Use the first ten returned rows as earliest because a previous run happened to return that order.
    4. Use insertion sequence as event time even when the contract supplies no relation between them.

    Answer: An explicit earliest-first ordering with a tie rule

    LIMIT alone constrains count, not which time-ordered rows are returned. Specify the intended timestamp ordering and any deterministic tie rule; physical layout or a prior execution's output is not the declared ordering.

  29. 29.Two versions of one record share the same update timestamp but have unique increasing version IDs. To choose the greatest timestamp, then greatest version ID, what window ordering implements the rule?

    Show answer and explanation
    1. ORDER BY updated DESC, version DESC
    2. ORDER BY updated DESC alone
    3. ORDER BY version ASC, updated DESC
    4. ORDER BY updated ASC, version DESC

    Answer: ORDER BY updated DESC, version DESC

    The second ordering term implements the stated tie policy. A unique final order makes selection reproducible for this rule; timestamp-only ordering leaves the two tied versions unresolved.

  30. 30.SQLite: rows (id,k,v)=(1,1,2),(2,1,5),(3,2,7). SUM(v) OVER (ORDER BY k,id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), output by id, gives what sequence?

    Show answer and explanation
    1. 14,14,14
    2. 2,5,7
    3. 2,7,14
    4. 7,7,14

    Answer: 2,7,14

    The ROWS prefix includes the current row and its predecessors in the stated unique order. The sums progress from two to seven to fourteen. The explicit id tie-breaker determines which equal-k row comes first.

  31. 31.SQLite: rows (id,k,v)=(1,1,2),(2,1,5),(3,2,7). SUM(v) OVER (ORDER BY k RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), output by id, gives what sequence?

    Show answer and explanation
    1. 2,7,14
    2. 14,14,14
    3. 2,5,7
    4. 7,7,14

    Answer: 7,7,14

    The RANGE current-row boundary includes the current row's ordering peers. Both k=1 rows therefore see the sum seven; the k=2 row sees fourteen. This peer-aware frame differs from a row-by-row prefix.

  32. 32.SQLite: values at unique ordered IDs 1,2,3 are 10,20,30. LAST_VALUE(v) OVER (ORDER BY id) uses the default frame. What sequence does it return by id?

    Show answer and explanation
    1. NULL,10,20
    2. 10,20,30
    3. 10,10,10
    4. 30,30,30

    Answer: 10,20,30

    With this ordering, the default frame ends at the current ordering peer group. Unique IDs leave the current value as last in its frame. To request the partition's final value, specify a suitable frame ending at UNBOUNDED FOLLOWING.

  33. 33.SQLite: a series has observations (day,v)=(1,4),(4,9),(8,12). What does LAG(v) OVER (ORDER BY day) return at day eight?

    Show answer and explanation
    1. 4
    2. 9
    3. NULL
    4. 12

    Answer: 9

    LAG refers to the preceding ordered observation, here day four's value nine. It does not synthesize a day-seven row or mean one calendar day earlier. Calendar-aligned comparison requires an appropriate date relationship.

  34. 34.SQLite: observations (day,v) are (1,10),(2,20),(10,30). At day ten, SUM(v) OVER (ORDER BY day ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) is what?

    Show answer and explanation
    1. 60
    2. 50
    3. 20
    4. 30

    Answer: 60

    The frame includes two preceding rows, regardless of the gap in day values: 10+20+30=60. It is a three-observation frame, not a last-three-calendar-days window.

  35. 35.SQLite: rows (team,id,v)=('a',1,2),('a',2,3),('b',3,7). SUM(v) OVER (PARTITION BY team ORDER BY id ROWS UNBOUNDED PRECEDING), output by id, gives what sequence?

    Show answer and explanation
    1. 2,5,7
    2. 5,5,7
    3. 2,5,12
    4. 12,12,12

    Answer: 2,5,7

    Each partition has its own cumulative sum. Team a progresses from two to five; team b starts independently at seven. A global order does not merge separate window partitions.

  36. 36.SQLite: scores 9,9,5 are ordered descending. What are their RANK() and DENSE_RANK() sequences?

    Show answer and explanation
    1. 1,2,2 and 1,1,2
    2. 1,1,3 and 1,1,2
    3. 1,1,2 and 1,1,3
    4. 1,2,3 and 1,2,3

    Answer: 1,1,3 and 1,1,2

    Both functions tie equal scores. RANK leaves a gap corresponding to the two rows occupying first place; DENSE_RANK advances by distinct score groups and gives the next group rank two.

  37. 37.SQLite: five uniquely ordered rows use NTILE(2) OVER (ORDER BY id). What bucket sequence is assigned in id order?

    Show answer and explanation
    1. 1,2,1,2,1
    2. 1,1,2,2,2
    3. 1,1,1,2,2
    4. 1,1,1,1,2

    Answer: 1,1,1,2,2

    NTILE divides the ordered rows into buckets as evenly as possible, with larger buckets first. Five rows across two buckets give three rows in bucket one and two in bucket two.

  38. 38.SQLite: ordered keys are 1,1,2. What does COUNT(*) OVER (ORDER BY k) return in that key order, using the default frame?

    Show answer and explanation
    1. 1,1,2
    2. 2,2,3
    3. 1,2,3
    4. 3,3,3

    Answer: 2,2,3

    The default ordered aggregate frame includes peers through the current ordering value. The two key-one rows both count two rows; key two counts all three. Add an explicit appropriate frame/order for a different intended running count.

  39. 39.Two versions of a ticket are (time,status)=(1,'open'),(2,'closed'). The target is tickets whose latest version is open. What operation order is required?

    Show answer and explanation
    1. Select each ticket's latest version, then filter its status.
    2. Filter open versions first, then choose each ticket's latest remaining version.
    3. Discard closed versions before defining the latest record.
    4. Count tickets with any historical open version.

    Answer: Select each ticket's latest version, then filter its status.

    Filtering history first can resurrect the older open version of a closed ticket. Resolve current state at the entity grain before applying a current-state predicate.

  40. 40.A daily running total must include history before a display window. The SQL WHERE clause removes all earlier days before the window SUM executes. What change preserves the desired history?

    Show answer and explanation
    1. Calculate the window first; filter its output for display.
    2. Replace SUM with MAX while retaining the same filtered input.
    3. Assume the window automatically reads rows removed by WHERE.
    4. Keep the early WHERE filter and rename the total cumulative.

    Answer: Calculate the window first; filter its output for display.

    Window calculations operate on the query's surviving rows. Separate calculation scope from display scope so earlier contributions remain available when the running total is formed.

  41. 41.Dimension versions use half-open validity intervals [0,10) and [10,20). An event has time ten. Joining with event time >= start AND event time < end matches which interval?

    Show answer and explanation
    1. [0,10) only
    2. Neither
    3. [10,20) only
    4. Both

    Answer: [10,20) only

    The first interval excludes its upper endpoint ten, while the second includes ten as its lower endpoint. Consistent half-open boundaries prevent this shared boundary from matching both consecutive versions.

  42. 42.An entity's dimension intervals are [0,15) and [10,20). An event occurs at twelve. What should an as-of join audit detect?

    Show answer and explanation
    1. Two matching versions caused by overlapping validity ranges
    2. A guarantee that selecting either match preserves historical classification
    3. No match because twelve is not an endpoint
    4. A uniquely identified current version because both ranges contain integers

    Answer: Two matching versions caused by overlapping validity ranges

    Twelve lies in both ranges, so an ordinary range join emits two matches. Enforce or audit temporal uniqueness, or apply a justified documented resolution; silently choosing a row can hide an inconsistent history.

  43. 43.SQLite: an open-ended dimension version has start=10,end=NULL. Which predicate explicitly treats NULL end as unbounded for event time t?

    Show answer and explanation
    1. t BETWEEN start AND end
    2. t>=start AND (end IS NULL OR t<end)
    3. t>=start AND end=NULL
    4. t>=start AND t<end

    Answer: t>=start AND (end IS NULL OR t<end)

    Ordinary comparison with NULL does not yield a true upper-bound check. The explicit nullness branch models the stated open-ended interval while retaining a strict upper bound for closed versions.

  44. 44.Record A occurred at event time ten and arrived at ingestion time thirty. Record B occurred at twenty and arrived at twenty-one. Which record is latest by event time, and which by ingestion time?

    Show answer and explanation
    1. B, then A
    2. B for both
    3. A, then B
    4. A for both

    Answer: B, then A

    Event chronology orders B after A, while arrival chronology orders A after B. Store and choose the relevant timestamp rather than assume arrival order defines business-event order.

  45. 45.A dashboard materializes event-day totals. A newly arrived event belongs to a day already summarized. The desired output includes all events received so far. What update is needed?

    Show answer and explanation
    1. Update the affected event-day aggregate, handling retries by event identity.
    2. Advance the arrival cursor and assume the historical event-day totals update themselves.
    3. Add every late arrival to today's event-day total, retaining historical totals unchanged.
    4. Ignore every record for any previously summarized day, even when it was never included.

    Answer: Update the affected event-day aggregate, handling retries by event identity.

    Incremental processing needs a correction strategy for affected event-time partitions. Preserve event identity to avoid duplicate addition on retries; successful cursor movement alone does not make the historical total complete.

  46. 46.A fact is effective January five but first recorded January ten. A question asks what the system knew on January seven. Can that fact be used solely because its effective date precedes the cutoff?

    Show answer and explanation
    1. Yes; effective time and knowledge time are interchangeable.
    2. No; an effective date can never precede arrival.
    3. No; its record/knowledge time is after that cutoff.
    4. Yes; every later correction was already available historically.

    Answer: No; its record/knowledge time is after that cutoff.

    A historical knowledge-as-of view constrains when information was available, separately from when it applies in the business timeline. Keeping both clocks prevents later information from leaking into an earlier reconstruction.

  47. 47.A source sends versions one and two of event E, with amounts five and eight. The target uses the highest version once, and version two is a full replacement. What is E's current contribution?

    Show answer and explanation
    1. 5
    2. 8
    3. 3
    4. 13

    Answer: 8

    A replacement contributes the selected version's full value, eight. Summing every version counts superseded state; using only the difference three would require an explicitly maintained earlier contribution and delta protocol.

  48. 48.Two distinct events have identical user, time, and value but different stable source event IDs. A retry duplicates one ID. What deduplication rule preserves the stated distinct events?

    Show answer and explanation
    1. Remove every repeated user ID.
    2. Deduplicate by stable event ID under the source version policy.
    3. Keep one record per user/time/value tuple.
    4. Keep the earliest physical database row regardless of source identity.

    Answer: Deduplicate by stable event ID under the source version policy.

    The source identity distinguishes two legitimate equal-valued events from a retry of one event. Deduplicating the payload can erase real activity; event identity and version semantics should drive retry handling.

  49. 49.A dimension changes at 15:00, and an event occurs at 10:00 that day. A join matches only the calendar date and attaches the later version. What historical information was lost?

    Show answer and explanation
    1. Only the displayed date format
    2. Within-day validity ordering
    3. A guarantee that every day has exactly one dimension version
    4. The event's existence in the source

    Answer: Within-day validity ordering

    A day-level key can be too coarse for changes within the day. Use the relevant effective-time intervals at sufficient precision rather than assume matching dates identify the historical state.

  50. 50.Timestamp A is 2026-01-01T00:30:00+02:00; B is 2025-12-31T23:00:00Z. Which is earlier as an instant, despite their different local date strings?

    Show answer and explanation
    1. The offsets cannot be converted to instants.
    2. A
    3. B
    4. They are simultaneous.

    Answer: A

    A is 2025-12-31 at 22:30 UTC, thirty minutes before B. Lexical comparison of differently offset strings does not generally represent instant order; normalize an appropriate representation before comparison.

  51. 51.SQLite: a source field is milliseconds since the Unix epoch and has value 86400000. Which expression converts it to the intended UTC timestamp?

    Show answer and explanation
    1. datetime(86400000,'start of day')
    2. datetime(86400000/1000.0,'unixepoch')
    3. datetime(86400000,'unixepoch')
    4. date(86400000)

    Answer: datetime(86400000/1000.0,'unixepoch')

    The source unit is milliseconds, while the unixepoch modifier interprets seconds. Dividing by one thousand gives 86,400 seconds and the intended 1970-01-02 00:00:00 UTC. An integer's storage type does not specify its time unit.

  52. 52.SQLite: what does date('2024-02-28','+2 days') return?

    Show answer and explanation
    1. 2024-02-29
    2. 2024-02-30
    3. 2024-03-01
    4. 2024-03-02

    Answer: 2024-03-01

    The supplied year is a leap year: one day after February twenty-eight is February twenty-nine, and the second day is March one. Date arithmetic is not textual addition to a day-number substring.

  53. 53.A business calendar uses a stated fixed UTC−05:00 offset, with no daylight-saving rule. An event occurs 2026-06-03 at 03:00 UTC. What business date contains it?

    Show answer and explanation
    1. 2026-06-03
    2. 2026-06-04
    3. The date cannot be determined even with the supplied fixed offset.
    4. 2026-06-02

    Answer: 2026-06-02

    Subtracting five hours gives 22:00 on June two. The question supplies a fixed offset; do not substitute a named region's possibly changing daylight-saving offset or bucket the raw UTC date unintentionally.

  54. 54.Two adjacent time buckets are implemented with inclusive BETWEEN predicates: [0,10] and [10,20]. What happens to an event at exactly ten when results are combined with UNION ALL?

    Show answer and explanation
    1. UNION ALL automatically chooses one bucket for boundary events.
    2. It appears in neither bucket.
    3. It appears only in the later bucket.
    4. It appears in both buckets.

    Answer: It appears in both buckets.

    BETWEEN includes both endpoints, so ten satisfies both predicates. Use consistent nonoverlapping boundaries, such as lower-inclusive and upper-exclusive, when each event should belong to exactly one adjacent bucket.

  55. 55.A service's observation calendar marks day two closed. Measured counts are ten on day one and twenty on day three. The target is mean per open observed day. What mean follows?

    Show answer and explanation
    1. 20
    2. 10
    3. 15
    4. 30

    Answer: 15

    There are two open observed days, totaling thirty events; 30/2=15. Dividing by all three calendar days would answer a different question and incorrectly include the closed day in this target's exposure denominator.

  56. 56.Events arrive for one user at minutes 0,30,61. A new session starts only when the gap from the previous event is strictly greater than thirty minutes. What session numbers follow?

    Show answer and explanation
    1. 1,2,3
    2. 1,1,2
    3. 1,1,1
    4. 1,2,2

    Answer: 1,1,2

    The first gap equals thirty and stays in session one. The next gap is thirty-one and starts session two. Implement the declared strictness explicitly rather than infer it from a label such as thirty-minute sessions.

  57. 57.A report needs cumulative distinct users by day. Users can return on later days. Which strategy counts each user once in that cumulative population?

    Show answer and explanation
    1. Cumulatively sum all event counts.
    2. Cumulatively sum each day's distinct-user count without accounting for returns.
    3. Sum daily counts and divide by the number of event types.
    4. Count users on their first eligible day, then cumulatively sum.

    Answer: Count users on their first eligible day, then cumulatively sum.

    First-eligible-day attribution partitions users into disjoint entry groups. A user's repeated visits must not create repeated additions to the cumulative unique population. Preserve the intended eligibility scope when computing first appearance.

  58. 58.Events have numeric days and values (1,10),(2,20),(10,30). The target at day ten is total on days four through ten inclusive. What value belongs to that calendar window?

    Show answer and explanation
    1. 0
    2. 50
    3. 30
    4. 60

    Answer: 30

    Only day ten falls in the stated seven-day inclusive interval. Row-based frames over a sparse series can include much older observations; an explicit calendar predicate or suitable numeric range represents this target.

  59. 59.A request's event timestamps are start=100,end=106 seconds. Its logs arrive at seconds 200 and 300 respectively. What is duration from the supplied event timestamps?

    Show answer and explanation
    1. 194 seconds
    2. 100 seconds
    3. 200 seconds
    4. 6 seconds

    Answer: 6 seconds

    The event-time duration is 106−100=6 seconds. Arrival lag describes a different pipeline clock. Clock comparability and measurement quality still matter, but subtracting arrival times would not implement the stated duration.

  60. 60.A daily duration report includes only jobs that finished before extraction, while many long-running jobs remain open. The target is duration for all jobs started that day. What selection must be addressed?

    Show answer and explanation
    1. A rule assigning every unfinished job duration zero
    2. Only whether completed job IDs are distinct
    3. Right-censoring/incomplete follow-up of unfinished jobs
    4. A guarantee that successful extraction means every job finished

    Answer: Right-censoring/incomplete follow-up of unfinished jobs

    The completed subset can overrepresent short jobs. Define suitable follow-up, censoring treatment, or a different explicitly scoped estimand rather than label observed completion durations as the full start cohort's duration distribution.

  61. 61.A signup cohort has users A,B,C. On the target return day A logs twice, B once, and C never. Retention is distinct returning cohort users divided by cohort users. What rate follows?

    Show answer and explanation
    1. 1
    2. 3/2
    3. 2/3
    4. 1/3

    Answer: 2/3

    Two distinct cohort members returned out of three. Repeated activity by A is not another retained user. Build numerator and denominator at the same declared cohort/user grain.

  62. 62.A dashboard compares seven-day retention for an old cohort and a cohort formed two days ago. What limitation prevents a complete seven-day comparison now?

    Show answer and explanation
    1. Two days of observation prove all seven-day outcomes for the new cohort.
    2. Every absent future event can be classified as a known nonreturn.
    3. The old cohort must be discarded because it is larger.
    4. The newer cohort lacks the required follow-up window.

    Answer: The newer cohort lacks the required follow-up window.

    Separate not-yet-observable outcomes from observed nonreturns. Use mature cohorts, an explicitly shorter target, or a justified time-to-event approach; time since signup is part of eligibility for the retention measure.

  63. 63.Signup is January one at 23:00 UTC and return is January eight at 01:00 UTC. A rule counts return only at elapsed time at least seven days after signup. Does this return qualify?

    Show answer and explanation
    1. Yes; the UTC calendar dates differ by seven.
    2. No; only six days and two hours elapsed.
    3. Yes; every event in January qualifies.
    4. No; exactly eight full days must elapse under the stated rule.

    Answer: No; only six days and two hours elapsed.

    The elapsed interval is 146 hours, below 168 hours. Calendar-date difference and elapsed-duration definitions are distinct; implement the one supplied rather than substitute a day-label shortcut.

  64. 64.An account's first event is in January and another in February. A SQL cohort query first filters events to February, then takes MIN(event time) per account and calls it lifetime first activity. What is wrong?

    Show answer and explanation
    1. The account necessarily belongs to both lifetime-first cohorts.
    2. MIN always chooses the latest row.
    3. The query cannot return any February row.
    4. Filtering removed earlier history before defining lifetime entry.

    Answer: Filtering removed earlier history before defining lifetime entry.

    First within a restricted window is not necessarily first in the full history. Compute lifetime first activity in the intended source scope before selecting cohorts by that derived timestamp.

  65. 65.Two users have (successes,attempts)=(1,1) and (0,9). The target is success probability per attempt. What pooled rate should SQL compute?

    Show answer and explanation
    1. 0
    2. 1
    3. 0.50
    4. 0.10

    Answer: 0.10

    The target is total successes divided by total attempts: (1+0)/(1+9)=0.10. Averaging user-level rates gives 0.50 and answers an equally weighted user-rate question instead.

  66. 66.A funnel requires event A strictly before B for the same user. Both recorded timestamps are equal, and no finer sequence information exists. What does that evidence establish?

    Show answer and explanation
    1. Both strict orderings are established.
    2. A necessarily precedes B because its label sorts first.
    3. The strict order is not established.
    4. B necessarily precedes A because it is the final funnel step.

    Answer: The strict order is not established.

    Equality does not satisfy a strict time inequality. Obtain an authoritative sequence or define a different tie policy if needed; arbitrary row order should not be presented as observed event chronology.

  67. 67.One user completes three distinct purchase IDs in a window. The business target is unique purchasers, while the query counts distinct purchase IDs. What is the numerator mismatch?

    Show answer and explanation
    1. Three transactions are being counted instead of one purchasing user.
    2. Distinct purchase IDs prove three distinct purchasers.
    3. The query necessarily returns zero because a user repeats.
    4. Transaction identity and user identity are interchangeable for all conversion metrics.

    Answer: Three transactions are being counted instead of one purchasing user.

    A deduplicated event count still has the event grain. Choose the user identity for unique purchasers and define the eligible user denominator; DISTINCT alone does not select the intended entity.

  68. 68.A date spine left-joins daily sensor totals. A missing total can mean a telemetry outage rather than zero physical events. What must precede unconditional COALESCE(total,0)?

    Show answer and explanation
    1. Treat each missing date as a measured zero solely because a date-spine row exists.
    2. Evidence distinguishing missing measurement from observed zero
    3. Drop every date that has no matching aggregate, then describe the remaining series as complete.
    4. Fill every unmatched date with zero, assuming join absence proves that the sensor observed no events.

    Answer: Evidence distinguishing missing measurement from observed zero

    A calendar join supplies dates, not observations. Filling unknown measurement with zero asserts information the join does not provide; use completeness evidence and an appropriate missingness policy.

  69. 69.A complete activity feed has users A,B, and only A has one event with a non-NULL event ID. To obtain zero for B after a LEFT JOIN, what aggregate counts actual matched events?

    Show answer and explanation
    1. COUNT(*)
    2. COUNT(COALESCE(event.id,0))
    3. SUM(user.id IS NOT NULL)
    4. COUNT(event.id)

    Answer: COUNT(event.id)

    The right-side event ID counts actual events and ignores B's null-extended row. COUNT(*) or an expression made non-NULL for that row counts the preserved user row rather than zero events.

  70. 70.A session's events are 23:55 and 00:05 on adjacent dates. The stated rule starts a session only after an inactivity gap greater than thirty minutes. How many sessions contain these two events?

    Show answer and explanation
    1. 1
    2. 2, because the rule is assumed to reset automatically at midnight
    3. 0, because cross-midnight events are discarded by the stated gap rule
    4. 2, because every change of calendar date counts as more than thirty inactive minutes

    Answer: 1

    The gap is ten minutes, so the midnight boundary does not split the session under this rule. Calendar-day reporting and sessionization use different boundaries unless the specification explicitly connects them.

  71. 71.A cumulative device counter reads 98,103,4. Documentation says a reset may occur and there is no wrap modulus supplied. What should a naive negative delta flag?

    Show answer and explanation
    1. A physically negative number of newly counted events proved by subtraction
    2. A counter discontinuity needing source-specific handling
    3. A guarantee that all three readings belong to different devices
    4. Exactly 4,294,967,197 new events from an assumed 32-bit wrap

    Answer: A counter discontinuity needing source-specific handling

    A negative change conflicts with a simple monotone cumulative-count interpretation. Diagnose reset/wrap/identity semantics using evidence rather than invent a modulus or silently include a negative event count.

  72. 72.SQLite: a rate expression is 1.0*n/NULLIF(d,0). For n=5,d=0, what is the result?

    Show answer and explanation
    1. NULL
    2. Infinity
    3. 5
    4. 0

    Answer: NULL

    NULLIF makes the zero denominator NULL, and the division yields NULL. That handles the expression explicitly but does not decide whether an undefined rate should be omitted, labeled, or treated by another business policy.

  73. 73.Daily aggregates contain (sum,count)=(10,1),(0,9). The target is the mean of all ten underlying nonmissing values. What computation preserves it?

    Show answer and explanation
    1. SUM(daily mean)=10
    2. MAX(daily mean)=10
    3. SUM(daily sum)/SUM(daily count)=1
    4. AVG(daily mean)=5

    Answer: SUM(daily sum)/SUM(daily count)=1

    The ten values total ten, so their pooled mean is one. Averaging daily means equally weights days instead of observations. Preserve sufficient aggregates and the relevant denominator when combining partitions.

  74. 74.SQLite: x(v) has three values 0.4. What are SUM(ROUND(v,0)) and ROUND(SUM(v),0)?

    Show answer and explanation
    1. 1.2 and 1.2
    2. 0 and 1
    3. 0 and 0
    4. 1 and 1

    Answer: 0 and 1

    Rounding each 0.4 first gives three zeros. Summing before rounding gives about 1.2, which rounds to one. The chosen rounding stage is part of the calculation and can affect reconciliations.

  75. 75.SQLite: SELECT CAST('12x' AS INTEGER) returns twelve. A source validator uses that successful cast as proof that the entire field is a valid integer token. What is missing?

    Show answer and explanation
    1. Treat any non-NULL converted integer as proof that no input characters were discarded.
    2. Accept all text with a numeric prefix as a valid full integer token, regardless of the source grammar.
    3. Repeat the same permissive cast and treat agreement as validation of the complete original token.
    4. Full-token numeric validation under the source contract

    Answer: Full-token numeric validation under the source contract

    A permissive conversion can accept a numeric prefix while discarding invalid trailing content. Validate the complete token and required range according to the source contract; coercion success is not strict format validation.

  76. 76.Dates are stored as unpadded text '2/1/2026' and '11/1/2026' in month/day/year form. Why can ORDER BY that text misorder calendar dates?

    Show answer and explanation
    1. Lexical ordering of this representation differs from chronological ordering.
    2. All text dates automatically use numeric month comparison.
    3. SQL prohibits ordering a text column.
    4. November must precede February in calendar order.

    Answer: Lexical ordering of this representation differs from chronological ordering.

    With a text comparison, the leading '1' in eleven sorts before '2'. Parse or canonicalize a valid date representation rather than assume an arbitrary display format orders chronologically.

  77. 77.All timestamp strings are valid, equally precise, fixed-width YYYY-MM-DDTHH:MM:SSZ in the same UTC calendar. What property supports chronological ordering with a binary text sort here?

    Show answer and explanation
    1. One normalized, fixed-width, largest-unit-first representation
    2. A text sort converts every row through the machine's local timezone.
    3. Text always orders every timestamp format correctly.
    4. The trailing Z alone makes mixed-length malformed dates comparable.

    Answer: One normalized, fixed-width, largest-unit-first representation

    Under the supplied uniform representation, lexical component order matches time order. The guarantee depends on normalization and validity; mixed offsets, precision, or date formats require separate treatment.

  78. 78.Events have precise UTC timestamps. A monthly filter uses t>=month start AND t<next month start. What boundary property does it provide?

    Show answer and explanation
    1. It requires every timestamp to have whole-second precision.
    2. It makes invalid or mixed-zone timestamps valid automatically.
    3. No need to guess the month's last representable instant
    4. It includes the first instant of the following month.

    Answer: No need to guess the month's last representable instant

    A strict upper boundary at the next period's start works across supported subsecond precision. It does not validate the underlying representation or timezone; those remain separate data requirements.

  79. 79.A local timestamp records 01:30 on a stated clock-change day when that region repeats the 01:00 hour. Neither offset nor repeated-hour indicator is stored. What information is missing for a unique UTC instant?

    Show answer and explanation
    1. A rule that choosing the earlier occurrence is observed fact
    2. A guarantee that both local occurrences share the same instant
    3. Only whether minutes are printed with two digits
    4. Which occurrence/offset the timestamp represents

    Answer: Which occurrence/offset the timestamp represents

    A repeated local time can denote two different instants. Retain offset, authoritative UTC time, or sufficient zone/fold information; silently selecting one interpretation creates an unsupported chronology.

  80. 80.An interval starts at 00:30 with UTC−04:00 offset and ends at 02:30 with UTC−05:00 offset on the same local date. What elapsed duration follows from these supplied offsets?

    Show answer and explanation
    1. 3 hours
    2. 2 hours
    3. 1 hour
    4. 4 hours

    Answer: 3 hours

    The start is 04:30 UTC and the end 07:30 UTC. Elapsed duration is three hours, although the displayed local clock times differ by two. The supplied offsets suffice without assuming a named region's rules.

  81. 81.A processor has read every record with ingestion time at most noon. No upper bound on source lateness is supplied. What completeness claim is unsupported?

    Show answer and explanation
    1. That every event occurring before noon has already arrived
    2. That future ingestion may contain older event times
    3. That the processed set has an ingestion cutoff
    4. That ingestion time and event time are different fields

    Answer: That every event occurring before noon has already arrived

    An arrival cursor identifies processed arrivals, not all events that exist in event time. A stronger completeness claim needs a suitable source guarantee or justified lateness/watermark model.

  82. 82.An incremental reader saves only MAX(updated time), then resumes with updated time > saved value. A new row can arrive later with that same update time. What can happen?

    Show answer and explanation
    1. MAX automatically records all future rows sharing its value.
    2. The timestamp collision necessarily violates SQL uniqueness.
    3. The row must be read twice by the strict inequality.
    4. The equal-timestamp row can be skipped.

    Answer: The equal-timestamp row can be skipped.

    A strict scalar cursor can miss later arrivals on its boundary. Use an authoritative monotone sequence or a justified cursor/replay strategy that handles ties and late arrivals with stable identity.

  83. 83.A materialized count previously included an event that is now deleted upstream. The synchronizer processes inserts and updates but ignores deletions. What must its protocol support for current-state parity?

    Show answer and explanation
    1. Deletion-aware retractions or recomputation
    2. Process only inserts more frequently, leaving previously counted deleted events in place.
    3. Advance the update cursor and infer that absent source rows automatically subtract prior contributions.
    4. Rebuild only partitions with new surviving events, assuming deletions always create such an event.

    Answer: Deletion-aware retractions or recomputation

    Current-state parity includes removals as well as additions. Make deletion semantics and affected aggregate corrections explicit; replaying only existing inserts cannot reliably remove a contribution that disappeared.

  84. 84.A dashboard reads a numerator and denominator in separate statements while source updates continue. The database supplies no shared snapshot across those statements. What consistency risk remains?

    Show answer and explanation
    1. The two values can describe different source states.
    2. Matching table names force a single point-in-time view.
    3. Each SELECT necessarily uses the same global snapshot forever.
    4. The displayed ratio must exceed one.

    Answer: The two values can describe different source states.

    Individually valid reads can form a cross-state metric. Use a suitable consistent snapshot, transaction, version pin, or intentionally declared freshness contract for the combined calculation.

  85. 85.An analyst must reproduce a last-week report after backfills and dimension corrections. Which retained evidence directly supports that reconstruction?

    Show answer and explanation
    1. Retain only the data snapshot, omitting parameters and transformation changes affecting the result.
    2. The data snapshot and exact query/transformation versions and inputs
    3. Retain only a screenshot and assume the current mutable source reproduces the underlying old rows.
    4. Retain only the query text, omitting the data snapshot even though backfills change its input.

    Answer: The data snapshot and exact query/transformation versions and inputs

    Reproducibility requires identifying both the data and the rules that produced a result. Current sources can legitimately differ after corrections; a timestamped screenshot alone does not reconstruct their former contents or transformation semantics.

  86. 86.A consistent snapshot contains account balances ten and twenty. A transfer commits later, changing them to seven and twenty-three. A report reads both accounts in that original snapshot. What total should it see?

    Show answer and explanation
    1. 37
    2. 33
    3. 27
    4. 30

    Answer: 30

    The snapshot retains the original ten and twenty, totaling thirty. Mixing an old value with a new value would violate the stated shared snapshot. This example assumes the supplied snapshot semantics, not that all separate SQL reads automatically share them.

  87. 87.A key is unique only within a region. A report COUNT(DISTINCT local ID) combines two regions that both use ID seven for different entities. What should its distinct key include?

    Show answer and explanation
    1. Only the event timestamp, assuming all entities have distinct occurrence times
    2. Only the local ID, assuming equal codes always represent one entity across regions
    3. The region and local ID together
    4. Only the display name, without any uniqueness contract

    Answer: The region and local ID together

    The source identity has a composite scope. Distinct local IDs collapse separate entities across regions; count the actual composite identity through a suitable distinct relation or supported composite representation.

  88. 88.A device is enabled for two hours of a ten-hour observation window and emits six events while enabled. The target is events per enabled hour. What denominator applies?

    Show answer and explanation
    1. 10 hours
    2. 6 hours
    3. 8 hours
    4. 2 hours

    Answer: 2 hours

    The stated exposure denominator is time enabled, not wall-clock window length or event count. Confirm interval coverage and avoid double-counting overlapping enabled intervals when constructing that exposure from logs.

  89. 89.A grouping query replaces NULL region with the literal 'Unknown', but 'Unknown' is also a valid recorded region code. What identity issue arises?

    Show answer and explanation
    1. The valid code must be rejected solely because it also serves as the analyst's sentinel.
    2. Missing-region rows merge with a distinct legitimate code.
    3. Both original categories remain separate because the expression remembers which values were NULL.
    4. NULL rows are excluded automatically by COALESCE, preserving all nonmissing codes.

    Answer: Missing-region rows merge with a distinct legitimate code.

    A display sentinel can collide with real data. Preserve missingness separately or use a collision-free representation appropriate to the contract instead of merging distinct categories unintentionally.

  90. 90.A query constructs composite identity by concatenating two text fields without encoding boundaries. Pairs ('ab','c') and ('a','bc') occur. What problem follows?

    Show answer and explanation
    1. The collision proves the underlying two-column identities are equal.
    2. Both pairs produce 'abc' and collide.
    3. The pairs are guaranteed to remain distinct because they have two fields.
    4. SQL implicitly inserts an unambiguous field separator.

    Answer: Both pairs produce 'abc' and collide.

    Serialization must preserve field boundaries and escaping, or the query should operate on the original composite key. Even a delimiter requires a contract for delimiter-containing values.

  91. 91.SQLite: x(a,b) contains ('ab','c'),('a','bc'),('ab','c'). What is COUNT(*) FROM (SELECT DISTINCT a,b FROM x)?

    Show answer and explanation
    1. 3
    2. 1
    3. 0
    4. 2

    Answer: 2

    The subquery preserves the two-column tuples and removes only the repeated first pair. It returns two distinct pairs, unlike concatenating without boundaries, which would collapse both into the same text.

  92. 92.SQLite: what does date('2026-06-01T00:30:00+02:00') return under its offset-aware time parsing?

    Show answer and explanation
    1. 2026-06-02
    2. 2026-06-01
    3. NULL
    4. 2026-05-31

    Answer: 2026-05-31

    The supplied offset converts the instant to May thirty-one at 22:30 UTC; the date function returns that UTC date. Extracting the first ten source characters would instead select the local date and answer a different bucketing question.

  93. 93.A time-series chart linearly interpolates a missing sensor value. The report then counts the interpolated point as an actually observed measurement. What distinction is lost?

    Show answer and explanation
    1. Only the interpolation method changes; the number of actually measured points necessarily rises.
    2. Modeled/imputed values versus observed data
    3. Interpolation proves the unmeasured sensor value was exactly the midpoint under every possible process.
    4. Every linearly imputed point becomes a verified observation once written into a SQL table.

    Answer: Modeled/imputed values versus observed data

    Interpolation can serve an explicit modeling/display purpose without creating an observation. Preserve provenance and assumptions so later sample sizes, uncertainty calculations, or totals do not misrepresent imputed points as measured facts.

  94. 94.For a fixed signup cohort with complete follow-up, one metric means returned at least once by day d; another means returned on day d. Which monotonicity statement is valid by definition?

    Show answer and explanation
    1. Both metrics must be equal each day.
    2. The by-day metric is nondecreasing.
    3. The cumulative metric must strictly increase daily.
    4. The on-day metric must increase every day.

    Answer: The by-day metric is nondecreasing.

    The cumulative set expands or stays the same as the endpoint moves later. A specific day's return set can increase or decrease. Distinguish cumulative inclusion from activity in a particular time bucket.

  95. 95.SQLite: what does CAST(-1/60.0 AS INTEGER) return, and why is it unsafe as a floor-based minute bucket for negative epoch seconds?

    Show answer and explanation
    1. 0; truncation differs from floor, which is −1.
    2. NULL; negative numbers cannot be cast.
    3. 1; the cast takes an absolute value.
    4. −1; every integer cast is mathematical floor.

    Answer: 0; truncation differs from floor, which is −1.

    The division is about −0.0167, and integer conversion truncates toward zero. A pre-epoch floor bucket should be −1. Choose arithmetic implementing the declared boundary rule across both signs.

  96. 96.A query takes the latest 100 event rows in an inner SELECT, then counts users by region. The title claims regional totals over all history. What population did it actually summarize?

    Show answer and explanation
    1. The latest 100 distinct users, regardless of repeated event rows for the same user
    2. A separate latest-100-event population per region, even without partitioning the inner selection
    3. Only the selected latest 100 rows
    4. All historical rows, because outer aggregation automatically restores rows excluded by the inner LIMIT

    Answer: Only the selected latest 100 rows

    An inner LIMIT changes the input population before aggregation. The count is conditional on that chosen event subset; it does not recover all-history totals or a separate per-region cap automatically.

  97. 97.Events have equal coarse timestamps but distinct IDs. Sorting by timestamp then ID makes a funnel query deterministic. What claim does that tie-breaker not establish without a source contract?

    Show answer and explanation
    1. That the query has a deterministic ordering rule
    2. That the IDs distinguish the recorded events
    3. That a declared arbitrary tie policy can be reproduced
    4. That ID order represents actual event-time order

    Answer: That ID order represents actual event-time order

    Determinism is different from observed chronology. A stable tie-breaker can implement a disclosed convention; proving event sequence needs an authoritative source rule or finer temporal information.

  98. 98.A query replaces every unknown event timestamp with extraction time and then calls the ordered result the observed event chronology. What has changed?

    Show answer and explanation
    1. The replacement proves that every event occurred at extraction.
    2. Only the timestamp's display precision changed.
    3. A processing-time assumption replaced unknown event time.
    4. The missing event times have been recovered exactly.

    Answer: A processing-time assumption replaced unknown event time.

    A fallback time can be useful under an explicit policy but is not a recovered observation. Preserve missingness and the chosen surrogate clock rather than present an invented time as measured occurrence.

  99. 99.A historical event has a valid entity key but falls into a gap between that entity's recorded dimension validity intervals. What should the temporal join quality check distinguish?

    Show answer and explanation
    1. A guarantee that the current dimension row was valid in the gap
    2. A rule silently moving the event to the nearest interval
    3. A temporal coverage gap from a nonexistent entity key
    4. Only duplicate payload values across unrelated events

    Answer: A temporal coverage gap from a nonexistent entity key

    Key existence alone does not guarantee historical version coverage. Audit unmatched events with their temporal conditions and investigate missing/corrected history rather than automatically attach a present-day classification.

  100. 100.A transformed table's grand total matches its source, but some amounts may have moved between accounts. What additional check addresses that concern?

    Show answer and explanation
    1. Declare row-level parity solely from the grand total.
    2. Reconcile identities and amounts at the account grain.
    3. Compare only the transformed table's column names.
    4. Round both grand totals until they match.

    Answer: Reconcile identities and amounts at the account grain.

    Equal grand totals can hide offsetting misallocations. Reconcile identities and the required finer-grain amounts, along with relevant temporal/version scope; one invariant does not prove every row relationship.

  101. 101.January's distinct users are A,B and February's are B,C. What is the distinct-user count across both months, compared with the sum of monthly distinct counts?

    Show answer and explanation
    1. 4 versus 4
    2. 3 versus 3
    3. 2 versus 3
    4. 3 versus 4

    Answer: 3 versus 4

    The combined user set is A,B,C, while the monthly counts sum to 2+2=4 and count returning user B twice. Distinct counts are not generally additive across overlapping populations; preserve mergeable identity evidence for the target scope.