Sie sind auf Seite 1von 5

1. You pass a value-type variable into a procedure as an argument.

The procedure changes the variable; however,


when the procedure returns, the variable has not changed. What happened? (Choose one.)
A. The variable was not initialized before it was passed in.
B. Passing a value type into a procedure creates a copy of the data.
C. The variable was redeclared within the procedure level.
D. The procedure handled the variable as a reference.

2. When should you use the StringBuilder class instead of the String class?
A. When building a string from shorter strings.
B. When working with text data longer than 256 bytes.
C. When you want to search and replace the contents of a string.
D. When a string is a value type.

3. You are creating a generic class, and you need to dispose of the generic objects. How can you do this?
A. Call the Object.Dispose method.
B. Implement the IDisposable interface.
C. Derive the generic class from the IDisposable class.
D. Use constraints to require the generic type to implement the IDisposable interface.

4. Structures inherit ToString from System.Object. Why would someone override that method within a structure?
(Choose as many correct answers as apply.)
A. To avoid boxing.
B. To return something other than the type name.
C. The compiler requires structures to override the ToString method.
D. To avoid run-time errors caused by invalid string conversions

5. Which of the following are types of changes that can be detected by the File-SystemWatcher? (Choose all that
apply.)
A. New files
B. New directories
C. Changed files
D. Renamed files
E. None

6. How do you force changes in a StreamWriter to be sent to the stream it is writing to? (Choose all that apply.)
A. Close the StreamWriter.
B. Call the Flush method of the StreamWriter.
C. Set the AutoFlush property of the StreamWriter to true.
D. Close the stream.
7. Which of the following create a FileStream for writing when you want to open an existing file or create a new one
if it doesn’t exist? (Choose all that apply.)
A. Create a new instance of the FileStream class, with the FileMode option of OpenOrCreate.
B. Call File.Create to create the FileStream.
C. Call File.Open with the FileMode option of OpenOrCreate.
D. Call File.Open with the FileMode option of Open.

8. You are writing an application to update absolute hyperlinks in HTML files. You have loaded the HTML file into a
String named s. Which of the following code samples best replaces “http://” with “https://”?
A.
' VB
s = Regex.Replace(s, "http://", "https://")
// C#
s = Regex.Replace(s, "http://", "https://");
B.
' VB
s = Regex.Replace(s, "https://", "http://")
// C#
s = Regex.Replace(s, "https://", "http://");
C.
' VB
s = Regex.Replace(s, "http://", "https://", RegexOptions.IgnoreCase)
// C#
s = Regex.Replace(s, "http://", "https://", RegexOptions.IgnoreCase);
D.
' VB
s = Regex.Replace(s, "https://", "http://", RegexOptions.IgnoreCase)
// C#
s = Regex.Replace(s, "https://", "http://", RegexOptions.IgnoreCase);

9. What is the Comparer class used for? (Choose all that apply.)
A. To compare two objects, usually for sorting
B. To test whether two objects are the same reference of an object
C. To sort an ArrayList in the ArrayList.Sort method
D. To provide a default implementation of the IComparer interface

10. In what order does a Stack retrieve items as you use its Pop method?
A. Random order
B. First-in, first-out
C. Last-in, first-out
D. Last-in, last-out
11. Which of the following statements is true?
A. You can pass an instance of a class that supports the IEqualityComparer interface when you construct a
Hashtable to change the way keys are evaluated for uniqueness.
B. You can assign an IEqualityComparer object to an existing Hashtable.
C. You cannot use an IEqualityComparer with a Hashtable.
D. A Hashtable implements IEqualityComparer.

12. What kind of object does the generic Dictionary enumerator return?
A. Object
B. Generic KeyValuePair objects
C. Key
D. Value

13. Which of the following attributes should you add to a class to enable it to be
serialized?
A. ISerializable
B. Serializable
C. SoapInclude
D. OnDeserialization

14. What type of object is required when starting a thread that requires a single parameter?
A. ThreadStart delegate
B. ParameterizedThreadStart delegate
C. SynchronizationContext class
D. ExecutionContext class

15. Which tool can be used to create a COM consumable type?


A. TlbImp.exe
B. TlbExp.exe
C. Regedit.exe
D. csc.exe

16. You need to use a structure for a given P/Invoke call. What should you do? (Choose all that apply.)
A. Define the structure in your .NET code first.
B. Use the SizeOf method of the System.Runtime.Marshal class if the size of the structure is needed.
C. Use the StructLayout attribute if positioning within the structure is important.
D. Create a new structure, and use the Type Library Exporter to create a type library. Reference this from your
assembly, and it will serve as the necessary proxy for your Structure.
17. What method of the MethodBase class allows for synchronous execution of a method with two parameters and
returns a Boolean value?
A.
' VB
method.Invoke(returnValue, param1, param2)
// C#
method.Invoke(ref returnValue, param1, param2);
B.
' VB
Dim result As Boolean = CType(method.Invoke(param1, param2),Boolean)
// C#
bool result = (bool)method.Invoke(param1, param2);
C.
' VB
Dim result As Boolean = _
CType(method.Invoke(theInstance, param1, param2),Boolean)
// C#
bool result = (bool)method.Invoke(theInstance, param1, param2);
D.
' VB
Dim result As Boolean = CType(method.Invoke(theInstance, _
new Object() { param1, param2 }),Boolean)
// C#
bool result = (bool)method.Invoke(theInstance,
new object[] {param1, param2});

18. What values of the AssemblyBuilderAccess enumeration allow you to execute the assembly?
A. AssemblyBuilderAccess.Run
B. AssemblyBuilderAccess.ReflectionOnly
C. AssemblyBuilderAccess.RunAndSave
D. AssemblyBuilderAccess.Save

19. If you were creating a culture of your own using the CultureAndRegionInfoBuilder class, which value would you
set for the CultureAndRegionModifiers parameter?
A. None
B. Neutral
C. Replacement
20. Which code segment shows the best way to retrieve the “Foo” section of the following configuration file?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Foo" value="Hello World!"/>
</appSettings>
</configuration>
A.
NameValueCollection AllAppSettings = ConfigurationManager.AppSettings;
Console.WriteLine(AllAppSettings["Hello World!"]);
B.
Console.WriteLine(ConfigurationSettings.AppSettings["Foo"]);
C.
NameValueCollection AllAppSettings = ConfigurationManager.AppSettings;
Console.WriteLine(AllAppSettings[5]);
D.
NameValueCollection AllAppSettings = ConfigurationManager.AppSettings;
Console.WriteLine(AllAppSettings["Foo"]);

Das könnte Ihnen auch gefallen