nerdexam
Microsoft

70-433 · Question #79

You need to determine the result of executing this code segment. DECLARE @RangeStart INT = 0; DECLARE @RangeEnd INT = 10000; DECLARE @RangeStep INT = 1; WITH NumberRange(ItemValue) AS ( SELECT…

The correct answer is C. 101 rows will be returned with a maximum recursion error. See the full explanation below for the reasoning.

Question

You need to determine the result of executing this code segment. DECLARE @RangeStart INT = 0; DECLARE @RangeEnd INT = 10000; DECLARE @RangeStep INT = 1; WITH NumberRange(ItemValue) AS ( SELECT ItemValue FROM (SELECT @RangeStart AS ItemValue) AS t UNION ALL SELECT ItemValue + @RangeStep FROM NumberRange WHERE ItemValue < @RangeEnd) SELECT ItemValue FROM NumberRange OPTION (MAXRECURSION 100) Which result will be returned?

Options

  • A101 rows will be returned with no error.
  • B10,001 rows will be returned with no error.
  • C101 rows will be returned with a maximum recursion error.
  • D10,001 rows will be returned with a maximum recursion error.

How the community answered

(45 responses)
  • A
    9% (4)
  • B
    2% (1)
  • C
    73% (33)
  • D
    16% (7)

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice