Practice Questions for Exam 70-536 (MCTS - Microsoft Certified Technology Specialist)
QUESTIONS Technology Focus: Developing applications that use system types and collections
1. You are
developing a text processing application by using the .NET Framework.
You write the following code to iterate over a collection of strings and
populate a ListBox control with the values it contains (line numbers
are for reference only). The GetStrings function returns an array of
strings.
C#
01: StringCollection myStrCol = new StringCollection();
02: myStrCol.AddRange(GetStrings());
03: StringEnumerator myEnumerator = myStrCol.GetEnumerator();
Visual Basic
01: Dim myStrCol As StringCollection = New StringCollection()
02: myStrCol.AddRange(GetStrings())
03: Dim myEnumerator As StringEnumerator = myStrCol.GetEnumerator()
|
You need to add code to populate the ListBox control. What code should you add?
Option A
C#
while (myEnumerator.MoveNext())
lstStrings.Items.Add(myEnumerator.Current);
Visual Basic
While (myEnumerator.MoveNext())
lstStrings.Items.Add(myEnumerator.Current)
End While
|
|
Option B
C#
do
{
lstStrings.items.Add(myEnumerator.Current)
} while (myEnumerator.MoveNext())
Visual Basic
Do
lstStrings.items.Add(myEnumerator.Current)
Loop While (myEnumerator.MoveNext())
|
|
Option C
C#
myEnumerator.Reset();
do
{
lstStrings.items.Add(myEnumerator.Current)
} while (myEnumerator.MoveNext())
Visual Basic
myEnumerator.Reset()
Do
lstStrings.items.Add(myEnumerator.Current)
Loop While (myEnumerator.MoveNext())
|
|
Option D
C#
do
{
lstStrings.items.Add(myEnumerator.Current)
myEnumerator.Reset();
} while (myEnumerator.MoveNext())
Visual Basic
myEnumerator.Reset()
Do
lstStrings.items.Add(myEnumerator.Current)
Loop Until (myEnumerator.MoveNext())
|
|
good job dear, very few people do like this
ReplyDeleteits really good..... very hard to understand......
ReplyDelete