.net2.0(C#)测试题
多选:
1. Which of the following are true about anonymous methods?
a. Anonymous methods have access to the local state of the containing function member
b. An anonymous method requires an explicit method signature
c. An anonymous method can impact the lifetime of local variables and parameters of the containing function
d. An anonymous method can access ref and out parameters of the containing function
e. A struct may not declare an anonymous method which directly references member fields
2. Which of the following conditions are true regarding System.Diagnostics.Trace?
a. Trace is enabled for both Release and Debug initial configurations
b. Trace can be controlled both by preprocessor directives, And complier directives
c. To change the severity levels which generate output, you must recompile you program
d. You can create enhanced capabilities by inheriting from the System.Diagnostics.Trace class
3. Which of the following are true about Nullable types?
a. A Nullable type is a reference type.
b. A Nullable type is structure.
c. An implicit conversion exists from any non-nullable value type to a nullable from of that type.
d. An implicit conversion exists from any nullable value type to a non-nullable from of that type.
e. A predefined conversion from the nullable type S to the nullable type T exists if there is a predefined conversion from the non-nullable type S to the non nullable type T
4. Which of the following are true for parameters?
a. Change to value parameters always involve making a copy of the original argument
b. Items passed as Reference Parameters must be initialized prior to the call
c. Output Parameters do not need to be assigned inside the method
d. Variable Length argument lists are not supported
5. Which of the following are true about event handing?
a. One method may handle event from different sources
b. A single event can be handled by multiple methods
c. Event handlers must be members of the same class as raised the event
d. Event handlers can be dynamically added and removed at runtime
e. It is impossible to determine the order in which event handlers will be invoked
6. Which of the following are true about namespaces and assemblies?
a. Namespaces may be used to control access to contained classes
b. Assemblies may be used to control access to contained classes
c. Namespaces may be aliased to provide a shorthand notation for a fully qualified identifier
d. The same namespace may be used in multiple assemblies
e. A single assemble may contain multiple namespaces
7. Which of the following are typical steps in creating a managed COM server component?
a. Assigning a GUID to each exposed interface and implementation via the System.Runtime.InteropServices.GuidAttribute
b. Enabling an unsafe code
c. Registering the server assembly with the system using RegAsm.exe
d. Registering the server assembly with the system using RegSvc32.exe
e. Making sure that the ComVisibleAttribute is not set to false for exported types and members
8. When Deleting a DataRow from the DataRowCollection of a DataTable, you can:
a. Use the DataRowCollection.Remove method to immediately delete the row.
b. Use the DataRowCollection.Remove method to mark the row for deletion when DataRow.AcceptChanges is called.
c. Use the DataRow.Delete method to immediately delete the row.
d. Use the DataRow.Delete method to mark the row for deletion when DataRowAcceptChanges is called.
9. Which of the following are true with respect to the standard implementation of Garbage Collection?
a. Objects must be set to null in order to be eligible for garbage collection
b. Unless specific steps are taken, an object may be moved in memory
c. Objects become eligible for garbage collection as soon as it is impossible for any code to access it
d. Objects which implement finalizers will always have the finalizer called at some point
10. which of the following are true about pointers?
a. C# does not support the use of “*” to indicate a pointer
b. Pointers are a type derived from System.Object
c. Pointers can be used as out and ref type parameters
d. Pointers references are tracked by the garbage collector.
e. Local variables do not require the use of a fixed statement to be used with pointers
11. Which of the following are defined as a “Token”?
a. Identifier
b. Whitespace
c. Punctuator
d. Operator
e. All of the above
12. Which of the following operators can be overloaded?
a. Assignment (=)
b. Conditional (&&, ||)
c. Logical (&, |, ^)
d. Shift (<< , >>)
13. Which of the following characteristics are found in an iterator?
a. It is a statement block which may contain a yield return statement to product the next value of the iteration
b. It is a statement block which may contain a yield break statement to product the next value of the iteration
c. It is a statement block which may contain a yield return statement to indicate that the iteration is complete
d. It is a statement block which may contain a yield break statement to indicate that the iteration is complete
e. It is a class which implements lenumerable
14. Which of the following properties are found in Static Constructors?
a. Static constructors are called before the main program is executed
b. Static constructors are called before the first instance of a class is created
c. Static constructors are called before any static (non-constructor) members are called
d. Static constructors can take parameters
e. If a static constructor throws an exception, never be invoked again and the type will remain uninitialized for the lifetime of the AppDomain
15. Which of the following can Interfaces contain?
a. Methods
b. Properties
c. Fields
d. Conversion operators
e. Events
16. Which of the following types guarantee atomic reads and writes?
a. int
b. double
c. string
d. long
e. float