Bird
0
0

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

easy📝 Syntax Q3 of 15
C Sharp (C#) - LINQ Fundamentals
Which of the following is the correct syntax to start a LINQ query in C#?
Avar result = foreach item in collection select item;
Bvar result = loop item in collection select item;
Cvar result = select item from collection;
Dvar result = from item in collection select item;
Step-by-Step Solution
Solution:
  1. Step 1: Recall LINQ query syntax

    The correct LINQ query starts with 'from' followed by 'in' and ends with 'select'.
  2. Step 2: Check each option

    Only var result = from item in collection select item; matches the correct LINQ syntax; others use invalid keywords.
  3. Final Answer:

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

    LINQ start syntax = from ... in ... select [OK]
Quick Trick: LINQ queries start with 'from' keyword [OK]
Common Mistakes:
MISTAKES
  • Using 'foreach' instead of 'from'
  • Placing 'select' before 'from'
  • Using 'loop' keyword incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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