Bird
Raised Fist0

Given a list of Employee objects with a FullName property, which LINQ query correctly selects only the FullName values?

easy🧠 Conceptual Q2 of Q15
C Sharp (C#) - LINQ Fundamentals
Given a list of Employee objects with a FullName property, which LINQ query correctly selects only the FullName values?
Afrom e in employees where e.FullName;
Bfrom e in employees select e.FullName;
Cfrom e in employees orderby e.FullName select e;
Dfrom e in employees group e by e.FullName;
Step-by-Step Solution
Solution:
  1. Step 1: Identify projection syntax

    The select clause projects the desired property.
  2. Step 2: Analyze options

    from e in employees select e.FullName; correctly selects FullName. from e in employees where e.FullName; misuses where. from e in employees orderby e.FullName select e; selects entire objects after ordering. from e in employees group e by e.FullName; groups data.
  3. Final Answer:

    from e in employees select e.FullName; -> Option B
  4. Quick Check:

    Projection uses select with property [OK]
Quick Trick: Use select to project properties [OK]
Common Mistakes:
MISTAKES
  • Using where instead of select for projection
  • Selecting entire objects instead of properties
  • Confusing grouping with projection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes