Professional Documents
Culture Documents
9.1 Introduction
1. The international standard for querying relational databases is called:
a) XML
b) SQL
c) HTTP
d) LINQ
Answer: b
4. LINQ allows you to select from a data source items that meet a set of conditions.
Answer: True.
2. The range variable is implicitly defined in the _____ clause and used to produce results
in the ______ clause
a) where, put
b) from, put
c) from, select
d) where, select
e) in, foreach
Answer: c
© Copyright 1992-2014 by Deitel & Associates, Inc. and Pearson Education, Inc. All Rights Reserved.
3. What method returns the number of items in LINQ query result q?
a) q.Length
b) q.Size
c) q.getUpperBound
d) q.Count
Answer: d
4. The range variable for the LINQ query must be of type IEnumerable.
Answer: False. IEnumerable is an interface for objects that can be iterated
through.
5. The objects returned when using multiple properties in a select clause are objects of
an anonymous type.
Answer: True.
6. If multiple properties are listed in the select clause, the results will be of type
SelectedList.
Answer: False. The query will return the properties in an object of an anonymous
class.
7. A generic method is a shorter way to express overloaded methods that have the same
name and same number of arguments, but process different types of data.
Answer: True.
8. A generic method does not need an object of the class in order to execute.
Answer: False. A static method (discussed in Chapter 10) does not need an object
in order to execute.
3. The ________ extension method is returns the number of results in a LINQ query.
a) Any
b) First
© Copyright 1992-2014 by Deitel & Associates, Inc. and Pearson Education, Inc. All Rights Reserved.
c) Count
d) None of the above
Answer: c
3. The ________ extension method indicates that only unique values should be included
in a LINQ query’s results.
a) Any
b) Distinct
c) Count
d) None of the above
Answer: b
4. The results of a LINQ query can have only the same type as the data being queried—
for example, a LINQ query on a collection of Employee objects will always have
Employee objects in the results.
Answer: False. A LINQ query’s select clause can be used to create new
anonymous types or new objects of existing types. For example, you could use the
select clause to select only the first name string of each employee, which would
result in a collection strings rather than a collection of Employees.
5. Elements can be added at any location within an array after it’s created.
© Copyright 1992-2014 by Deitel & Associates, Inc. and Pearson Education, Inc. All Rights Reserved.
Answer: False. You cannot add elements to an array once it’s created, you can only
change the value of an element. The List< T > collection allows elements to be
added at any location within the List< T >.
6. The Capacity property indicates the number of elements stored in the List< T >.
Answer: False. The Capacity property indicates the number of elements that can
be stored in the List< T > without resizing.
3. LINQ is used to query collections in the same way it’s used to query arrays.
Answer: True.
© Copyright 1992-2014 by Deitel & Associates, Inc. and Pearson Education, Inc. All Rights Reserved.
Another random document with
no related content on Scribd:
1.E.5. Do not copy, display, perform, distribute or redistribute
this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using
the method you already use to calculate your applicable
taxes. The fee is owed to the owner of the Project
Gutenberg™ trademark, but he has agreed to donate
royalties under this paragraph to the Project Gutenberg
Literary Archive Foundation. Royalty payments must be
paid within 60 days following each date on which you
prepare (or are legally required to prepare) your periodic tax
returns. Royalty payments should be clearly marked as
such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4,
“Information about donations to the Project Gutenberg
Literary Archive Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.