nerdexam
Microsoft

70-433 · Question #17

You work for a company that provides marketing data to other companies. You have the following Transact-SQL statement: DECLARE @CustomerDemographics XML SET @CustomerDemographics=N'…

The correct answer is A. <CoffeeDrinkingCustomer Age="27" />. See the full explanation below for the reasoning.

Question

You work for a company that provides marketing data to other companies. You have the following Transact-SQL statement:

DECLARE @CustomerDemographics XML SET @CustomerDemographics=N' <CustomerDemographics> <Customer CustomerID="1" Age="21" Education="High School"> <IsCoffeeDrinker>0</IsCoffeeDrinker> </Customer> <Customer CustomerID="2" Age="27" Education="College"> <IsCoffeeDrinker>1</IsCoffeeDrinker> <IsFriendly>1</IsFriendly> </Customer> <Customer CustomerID="3" Age="35" Education="Unknown"> <IsCoffeeDrinker>1</IsCoffeeDrinker> <IsFriendly>1</IsFriendly> </Customer> </CustomerDemographics>' DECLARE @OutputAgeOfCoffeeDrinkers XML SET @OutputAgeOfCoffeeDrinkers = @CustomerDemographics.query(' for $output in /child::CustomerDemographics/child::Customer[( child::IsCoffeeDrinker[1 ] cast as xs:boolean )] return <CoffeeDrinkingCustomer> { $output/attribute::Age } </CoffeeDrinkingCustomer>') SELECT @OutputAgeOfCoffeeDrinkers You need to determine the result of the query. What result should you expect?

Options

  • A<CoffeeDrinkingCustomer Age="27" />
  • B<CoffeeDrinkingCustomer Age="21" />
  • C<CustomerDemographics>
  • D<CustomerDemographics>

How the community answered

(37 responses)
  • A
    73% (27)
  • B
    16% (6)
  • C
    5% (2)
  • D
    5% (2)

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice