Bird
0
0

Which of the following is the correct way to start a LINQ query in C#?

easy📝 Syntax Q12 of 15
C Sharp (C#) - LINQ Fundamentals
Which of the following is the correct way to start a LINQ query in C#?
Aforeach item in collection { select item; }
Bselect item from collection;
Cquery collection select item;
Dfrom item in collection select item;
Step-by-Step Solution
Solution:
  1. Step 1: Recall LINQ query syntax

    LINQ queries start with the keyword 'from', followed by a variable and the data source.
  2. Step 2: Check each option's syntax

    Only from item in collection select item; uses the correct 'from ... in ... select ...' pattern. Others have wrong order or keywords.
  3. Final Answer:

    from item in collection select item; -> Option D
  4. Quick Check:

    LINQ starts with 'from' keyword [OK]
Quick Trick: LINQ queries always start with 'from' keyword [OK]
Common Mistakes:
MISTAKES
  • Swapping 'select' and 'from' keywords
  • Using foreach instead of LINQ syntax
  • Writing incomplete or invalid query statements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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