Q & A - Linq Question & Answers


Q&A 1.

Explain what is LINQ?

Language Integrated Query or LINQ is the collection of standard query operators which provides query facilities into.NET framework language like C#, VB.NET.

Q&A 2.

What are the types of LINQ?

Types of Linq are: 

  1.     LINQ to Objects
  2.     LINQ to XML
  3.     LINQ to Dataset
  4.     LINQ to SQL
  5.     LINQ to Entities

Q&A 3.

List out the three main components of LINQ? Explain what is the extension of the file, when LINQ to SQL is used?

Three main components of LINQ are

    Standard Query Operators
    Language Extensions
    LINQ Providers

The extension of the file used is .dbml.

Q&A 4.

Explain what is lambda expressions in LINQ?

Lambda expression is referred as a unique function use to form delegates or expression tree types, where right side is the output and left side is the input to the method. For writing LINQ queries particularly, Lambda expression is used.

Q&A 5.

Explain how LINQ with databases can be used?

LINQ supports XML, SQL, Dataset and Objects. Through LINQ to objects or LINQ to Datasets one can use LINQ with other databases. The objects and datasets take care of database particular operations, and LINQ only needs to deal with those objects and not the database operations directly.

Q&A 6.

Explain how to assign a lambda expression to a delegate?

Assigning lambda expression to a delegate, For eg:

Delegate int del (int i);

del myDelegate=x=>x*x;

Int j = myDelegate (5); // output j=25

Q&A 7.

Explain what is the difference between Statement Lambda and Expression Lambda?

Expression lambdas are generally used for constructing expression trees. While Statement lambdas cannot be used to create expression trees.

Q&A 8.

Explain DataContext classes in LINQ?

DataContext class acts as a bridge between SQL Server database and the LINQ to SQL. For accessing the database and also for changing the data in the database, it contains connections string and the functions.

Q&A 9.

What are LINQ query expressions?

Query expression is nothing but an LINQ query. It is a combination of query clauses that identifies the data sources for a query. It contains information for sorting, filtering, grouping or joining to apply to the source data. It determines what information should be retrieved from the data source.

Q&A 10.

Explain what is the purpose of LINQ providers in LINQ?

LINQ providers are set of classes that take an LINQ query which generates method that executes an equivalent query against a particular data source.

Related Quiz Content

This website is using cookies to make user experience of the site better. More info. OK