QUESTION 6
You work as the application developer at www.megaposts.net uses Visual
Studio.NET 2005 as its application development platform.
You are developing a .NET Framework 2.0 application used to store a type-safe list
of names and e-mail addresses. The list will be populated all at ones from the sorted
data which means you well not always need to perform insertion or deletion
operations on the data. You are required to choose a data structure that optimizes
memory use and has good performance.
What should you do?
A. The System.Collections.Generic.SortedList class should be used
B. The System.Collections.HashTable class should be used
C. The System.Collections.Generic.SortedDictionary class should be used
D. The System.Collections.SortedList class should be used
…
…
…
Answer: A
Explanation: The SortedList generic class should be used in the scenario class as it
provides type safety compared against the System.Collections.SortedList class.
Incorrect Answers:
B: The System.Collections.HashTable class should not be used as this class provides no
type safety.
C, D: Although this is very similar to the SortedList class the SortedList class should be
used instead in the scenario.
QUESTION 7
You work as an application developer at www.megaposts.net. You are currently in the
process of reviewing an application that was created by a fellow developer.
The application that you are reviewing includes a declaration for a collection named
EmployeeList, which stores Employee objects. The declaration is shown below:
public class EmployeeList : Enumerator, IEnumerable
{
// Class implementation
}
You require the ability to iterate through the EmployeeList with minimum
development effort.
What should you do?
A. Utilize the switch statement
B. Utilize the dowhile statement
C. Utilize the foreach statement
D. Utilize the if statement
…
…
…
Answer: C
Explanation: the IEnumerable and IEnumerator interfaces of the
System.Collections namespace are used to ensure that your collection class supports
foreach iteration. The IEnumerable interface defines only one method named
GetEnumerator that returns an object of type IEnumerator of the
System.Collections namespace and is used to support iteration over a collection. The
IEnumerator interface supports methods, such as Current, MoveNext, and Reset to
iterate through a collection. The Current method returns the current element of the
collection. The Move method positions the enumerator to the next available element
of the collection. The Reset method positions the enumerator before the first
element of the collection.
Incorrect Answers:
A D: These statements will not allow you to iterate through the EmployeeList
collection.
B: You should not use this statement because it will require manually calling the
MoveNext and Current methods. The scenario states that you need to “…iterate
through the EmployeeList with minimum development effort.”
QUESTION 8
You work as an application developer at www.megaposts.net has been
contracted to develop an application for the local bank.
You have been given the responsibility of creating this application and need to store
each transaction record, which is identified using a complex transaction identifier,
in memory. The bank informs you that the total amount of transaction records
could reach 200 per day.
To achieve this, you decide to utilize one of the existing collection classes in the .NET
2.0 class library.
You need to ensure that you the collection class you select is the most efficient one
for storing transaction records.
What should you do?
A. Select the ListDictionary collection class.
B. Select the HashTable collection class.
C. Select the Queue collection class.
D. Select the StringCollection collection class.
…
…
…
Answer: B
Explanation: You should select the HashTable class to store transaction records
because each element is identified using a unique identifier and the size of the
collection is large. Elements in the HashTable collection are stored with a key/value
pair where each key is created using a hash code. The default capacity of a
HashTable class is zero, and you can use the Add method to add a new element to
the collection. The Count property provides the total number of elements in the
HashTable collection. An element of the HashTable class can be accessed using the
DictionaryEntry class. You can use the Key and Value properties of the
DictionaryEntry class to access the key associated with the element and the value of
the element, respectively.
Incorrect Answers:
A: You should not select this collection class because this class is used if the total
number of elements to be stored in a collection is less than 10 elements in length.
C: You should not select this collection class because you need to access transaction
records using a transaction identifier, not in sequential order.
D: You should not select this collection class because this class is used to manage a
collection of string value
Refrence : MCTS 70-536 Question Bank

No comments:
Post a Comment