C# 笔试题,看你会几道题
2014-12-04 23:01
239 查看
1. Which interface you need to implement to support for each?
IEnumerator
IEnumerable
IComparer
IComparable
All of the above
None of the above
2. What is the “internal” keyword used for?
To make a method to be used internally by the declaring class only.
To make a field that is accessed by multiple threads.
To use with the DllImport attribute when using Interop services to call into unmanaged code.
None of the above
3. Read the following 2 statements about const and read-only field
A const field can only be initialised where it’s declared. A read-only field can be initialised where it’s declared or in a constructor.
A const field is set at compile time, but a read-only field is set at run time.
4. Read the following statements about structs.
Structs are value types.
Structs are reference types.
Structs can be directly derived from System.Object.
Structs can be directly derived from System.ValueType.
Structs only allocate memory from stack.
5. What is the keyword “delegate” used for?
Another visibility modifier like public, private, protected
Used in multi threaded programs to protect a variable
Used to define a method signature type that can be used as a typed variable
None of the above
6. What is “boxing”?
Wrapping an object into a value type
Wrapping a value type into an object
Wrapping a collection into a byte array
None of the above
7. Can I use “return” statement inside a “final” block?
Yes
No
8. Is Delegate a type of Event?
Yes
No
9. If x.Equals(y) is true. Is it correct that x.GetHashcode() != y.GetHashcode()?
Yes
No
10. int keyword targets to which .Net type?
System.Int8
System.Int16
System.Int32
System.Int64
IEnumerator
IEnumerable
IComparer
IComparable
All of the above
None of the above
2. What is the “internal” keyword used for?
To make a method to be used internally by the declaring class only.
To make a field that is accessed by multiple threads.
To use with the DllImport attribute when using Interop services to call into unmanaged code.
None of the above
3. Read the following 2 statements about const and read-only field
A const field can only be initialised where it’s declared. A read-only field can be initialised where it’s declared or in a constructor.
A const field is set at compile time, but a read-only field is set at run time.
4. Read the following statements about structs.
Structs are value types.
Structs are reference types.
Structs can be directly derived from System.Object.
Structs can be directly derived from System.ValueType.
Structs only allocate memory from stack.
5. What is the keyword “delegate” used for?
Another visibility modifier like public, private, protected
Used in multi threaded programs to protect a variable
Used to define a method signature type that can be used as a typed variable
None of the above
6. What is “boxing”?
Wrapping an object into a value type
Wrapping a value type into an object
Wrapping a collection into a byte array
None of the above
7. Can I use “return” statement inside a “final” block?
Yes
No
8. Is Delegate a type of Event?
Yes
No
9. If x.Equals(y) is true. Is it correct that x.GetHashcode() != y.GetHashcode()?
Yes
No
10. int keyword targets to which .Net type?
System.Int8
System.Int16
System.Int32
System.Int64