Exam Prep Language-Integrated Query (Linq) Chapter 14 - Test Bank | Visual C# 5e by Tony Gaddis. DOCX document preview.

Exam Prep Language-Integrated Query (Linq) Chapter 14

Starting Out with Visual C#, 5e (Tony Gaddis)

Chapter 14 Language-Integrated Query (LINQ)

TRUE/FALSE

1. LINQ is simply another name for SQL.

2. The .NET framework has LINQ tools that allow you to query many types of data.

3. LINQ to Objects allows you to query data stored in arrays and lists.

4. A LINQ query differs from a SQL query because a LINQ can never be used to query a database.

5. IEnumerable<T> is an interface that is defined in the .NET Framework where T is the data type of the individual elements in the data source.

6. When writing a LINQ query, you can use the var keyword to simplify the code.

7. LINQ queries always begin with a where clause and end with a from clause.

8. In a LINQ query the select clause determines what will be included in the results of the query.

9. A LINQ expression can only use a single where clause.

10. It is possible to sort the results of a LINQ query with the orderby clause.

11. There are two ways to write LINQ queries. You can use method syntax or query syntax.

12. If you use method syntax when writing a LINQ query, the compiler translates the query into query syntax.

13. The .NET Framework defines a set of LINQ extension methods that work with all collections in the framework.

14. All LINQ extension methods can be invoked with the LINQ query syntax.

15. A quantifier method returns true or false to indicate whether one or more elements in a collection match a condition.

16. An aggregation method provides the sum of the values from a collection of values.

17. An element method returns a specific element from a collection.

18. A partitioning method divides a collection into any number of sections and returns the section requested by the programmer.

19. It is possible to use LINQ to query a database by using an ORM which is an Object Relational Mapping tool.

20. When using LINQ to query a database, an entity object represents a column in a table in the database.

MULTIPLE CHOICE

1. LINQ stands for __________.

a.

Language-Invoked Query

c.

Language-Integrated Query

b.

Language Integration Query

d.

Language-Integrated New Query

2. Given an array of integers named ages, which of the following will query this array to get all values less than 20 and store the result in teens?

a.

var teens = from item in ages

where item < 20

select item;

b.

int teens = from item in ages

where item < 20

select item;

c.

var ages = from item in teens

where item < 20

select item;

d.

var teens = from ages

where item < 20

select item;

3. Which of the following is comparable to this LINQ query? The array, ages, is an array of integers.

var teens = from item in ages where item < 20 select item;

a.

int teens = from item in ages

where item < 20

select item;

b.

IEnumerable<int> teens = from item in ages

where item < 20

select item;

c.

IEnumerable<T> teens = from item in ages

where item < 20

select item;

d.

IEnumerable<int> ages = from item in teens

where item < 20

select item;

4. What values will the following code display?

int[] ages = { 12, 15, 26, 31, 18, 20 };

var teens = from item in ages

where item < 20

select item;

foreach (var value in teens)

{

MessageBox.Show(value);

}

a.

12, 15, 18, 20

c.

12, 15, 26, 31, 18, 20

b.

12, 15, 18

d.

26, 31

5. What values will the following code display?

int[] ages = { 12, 15, 26, 31, 18, 20 };

var teens = from item in ages

select item;

foreach (var value in teens)

{

MessageBox.Show(value);

}

a.

12, 15, 18, 20

c.

12, 15, 26, 31, 18, 20

b.

12, 15, 18

d.

26, 31

6. Which of the statements below is comparable to the code shown here? This code searches for any item in an array of ints named ages that is between 10 and 20, inclusive.

var results = from item in ages

where item > 9

where item < 21

select item;

a.

var results = from item in ages

where item > 9 and where item < 21

select item;

b.

var results = from item in ages

where item >= 10 && where item <= 20

select item;

c.

var results = from item in ages

where item > 9 or item < 21

select item;

d.

var results = from item in ages

where item > 9 && item < 21

select item;

7. Which of the following statements will sort the results of a LINQ query of the array shown below?

int[] ages = { 12, 45, 16, 23, 57, 2, 19 };

a.

var results = from item in ages

select item

orderby item;

b.

var results = from item in ages

where item > 0

select item

orderby item;

c.

var results = from item in ages

orderby item

select item;

d.

var results = orderby item in ages;

8. To sort the results of a LINQ query, you can use the __________.

a.

orderby clause

c.

orderup method

b.

orderbyascending clause

d.

order method

9. Queries written in method syntax take the form of __________.

a.

SQL statements

c.

method calls

b.

query syntax

d.

compiler calls

10. When you use query syntax, the C# compiler translates the queries into method calls that invoke __________ that are defined in the .NET Framework.

a.

extension methods

c.

SQL statements

b.

extension queries

d.

preprocessor directions

11. __________ methods return true or false to indicate whether one or more elements in a collection match a condition.

a.

Quantifier

b.

Aggregation

c.

Generation

d.

Set

12. __________ methods calculate a single value from a collection of values.

a.

Quantifier

b.

Aggregation

c.

Generation

d.

Set

13. __________ methods perform a mathematical set operation on two collections of values.

a.

Quantifier

b.

Aggregation

c.

Generation

d.

Set

14. The type of method that returns a specific element from a collection is a(n) __________ method.

a.

generation

b.

aggregate

c.

element

d.

select

15. The type of method that divides a collection into two sections and returns one of the sections is a(n) __________ method.

a.

From

b.

partitioning

c.

element

d.

Select

16. To use LINQ to query a database, you need to use a(n) __________.

a.

Relative Mapping tool

c.

ORT

b.

Object Relational Mapping tool

d.

SQL statement

17. When using LINQ to query a database, which of the following represents the database?

a.

a data context object

c.

an entity object

b.

a table object

d.

none of these

18. When using LINQ to query a database, which of the following represents a row in a table?

a.

a data context object

c.

an entity object

b.

a table object

d.

none of these

19. When using LINQ to query a database, which of the following represents a column in a table?

a.

a data context object

c.

an entity object

b.

a table object

d.

none of these

20. To set up LINQ to SQL to work with a database, you must first __________.

a.

add a connection to the database

b.

add a DBML file to the project

c.

use the Object Relational Designer to select the tables you want to work with

d.

define your entity objects

Document Information

Document Type:
DOCX
Chapter Number:
14
Created Date:
Aug 21, 2025
Chapter Name:
Chapter 14 Language-Integrated Query (Linq)
Author:
Tony Gaddis

Connected Book

Test Bank | Visual C# 5e

By Tony Gaddis

Test Bank General
View Product →

$24.99

100% satisfaction guarantee

Buy Full Test Bank

Benefits

Immediately available after payment
Answers are available after payment
ZIP file includes all related files
Files are in Word format (DOCX)
Check the description to see the contents of each ZIP file
We do not share your information with any third party