Point out the wrong statement about LINQ to SQL.

2023

Point out the wrong statement about LINQ to SQL.

  1. A.

    LINQ to SQL is translated to SQL by way of Binary Trees

  2. B.

    LINQ to SQL is translated to SQL calls and executed on the specified database, while LINQ to Objects is executed in the local machine memory

  3. C.

    LINQ to SQL uses deferred execution: query construction only builds an expression tree, and the SQL is generated and run only when the query is consumed — via enumeration or an executing operator such as ToList(), Count(), or First()

  4. D.

    LINQ to SQL needs a Data Context object

Show answer & explanation

Correct answer: A

Concept: A LINQ query provider translates the same LINQ syntax into a form suited to its target data source. LINQ to SQL's pipeline builds an expression tree — a runtime, traversable representation of the query's operators, method calls, and lambda bodies — and walks that tree to emit the equivalent T-SQL. A binary tree is an unrelated, general-purpose ordered-storage/search structure; it plays no role in this translation.

Application: The statement claiming the translation happens “by way of Binary Trees” swaps in that unrelated structure for the actual mechanism (expression trees), so it misdescribes how LINQ to SQL works — making it the wrong statement among the four.

Cross-check — the other three statements are each independently true, which confirms they are not the ones being asked for:

  • LINQ to SQL runs as SQL calls against the database server, while LINQ to Objects runs over in-memory collections on the local machine — a real architectural difference between the two providers.

  • LINQ to SQL uses deferred execution: query construction only builds an expression tree; the SQL is generated and run only when the query is consumed — via enumeration or an executing operator such as ToList(), Count(), or First().

  • LINQ to SQL requires a DataContext (or equivalent context object) to map entity classes to database tables and track changes.

Result: the wrong statement is the one claiming the translation happens “by way of Binary Trees” — the actual mechanism is expression trees.

Explore the full course: Cognizant Preparation

Loading lesson…