Recall & Review
beginner
What does LINQ stand for in C#?
LINQ stands for Language Integrated Query. It allows querying data in a readable and concise way directly in C# code.
Click to reveal answer
beginner
What is the basic structure of a LINQ query using query syntax?
A LINQ query using query syntax typically has this structure:<br>
from item in collection<br>where condition<br>select itemIt reads like a sentence: from a collection, pick items that meet a condition, then select them.
Click to reveal answer
beginner
How do you filter elements in a LINQ query syntax?
You use the
where keyword to filter elements. For example:<br>from num in numbers<br>where num > 5<br>select numThis selects numbers greater than 5.
Click to reveal answer
intermediate
Can you use multiple conditions in a LINQ query's where clause?
Yes, you can combine conditions using logical operators like
&& (and) or || (or).<br>Example:<br>from item in collection<br>where item.Age > 18 && item.IsActive<br>select item
Click to reveal answer
beginner
What keyword do you use in LINQ query syntax to order results?
You use the
orderby keyword to sort results.<br>Example:<br>from num in numbers<br>orderby num descending<br>select numThis orders numbers from highest to lowest.
Click to reveal answer
Which keyword starts a LINQ query in query syntax?
✗ Incorrect
A LINQ query starts with the
from keyword to specify the data source.How do you select only items where a number is greater than 10?
✗ Incorrect
The
where clause filters items. Use where num > 10 to select numbers greater than 10.Which keyword is used to sort results in LINQ query syntax?
✗ Incorrect
The
orderby keyword sorts the results in ascending or descending order.What does the
select keyword do in a LINQ query?✗ Incorrect
select defines what the query returns, like which fields or objects.Can you use multiple
where clauses in one LINQ query?✗ Incorrect
You can chain multiple
where clauses to filter data step by step.Explain the basic structure of a LINQ query using query syntax and how it works.
Think about how you pick items from a list based on conditions.
You got /4 concepts.
Describe how to filter and sort data using LINQ query syntax with examples.
Filtering is like choosing only what you want; sorting is arranging them.
You got /3 concepts.