GSSP-NET · Question #235
You work as a Windows Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a Windows Forms application using .NET Framework…
The correct answer is D. XDocument employees = XDocument.Load("Employees.xml"); var results = from c in. See the full explanation below for the reasoning.
Question
You work as a Windows Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a Windows Forms application using .NET Framework 3.5. You use LINQ expressions to read a list of employees from the following XML file:
<employees> <employee id="135" birthDate="5/01/1968"> Sam Paul </employee> <employee id="122" birthDate="3/05/1988"> Kelly Smith </employee> <employee id="044" birthDate="8/24/1990"> Joe Healy </employee> <employee id="582" birthDate="6/15/1974"> Matt Hardy </employee> <employee id="275" birthDate="2/07/2004"> Tom Altar </employee> <employee id="144" birthDate="9/23/1946"> Jeff Hay </employee> <employee id="444" birthDate="5/15/1947"> Kim Shane </employee> <employee id="243" birthDate="4/24/1980"> Mike Ray </employee> <employee id="363" birthDate="8/14/1975"> Allen Ryan </employee> <employee id="473" birthDate="1/15/1979"> Jackline Beneath </employee> <employee id="713" birthDate="9/09/1985"> Adam Ford </employee> <employee id="032" birthDate="5/04/1990"> Mike Tyson </employee> </employees> You are required to obtain a list of names of employees who are 23 years or older. Which of the following code segments will you use?
Options
- AXDocument employees = XDocument.Load("Employees.xml"); var results = from c in
- BXDocument employees = XDocument.Load("Employees.xml"); var results = from c in
- CXDocument employees = XDocument.Load("Employees.xml"); var results = from c in
- DXDocument employees = XDocument.Load("Employees.xml"); var results = from c in
How the community answered
(27 responses)- A7% (2)
- B19% (5)
- C4% (1)
- D70% (19)
Community Discussion
No community discussion yet for this question.