This site is 100% ad supported. Please add an exception to adblock for this site.

Exam 70-356: .NET Framework 2.0 System Types

Terms

undefined, object
copy deck
Identify the two main categories of value types.
1. Structures
2. Enumerations
Describe assignment and copy semantics of value types.
Variables that are based on value types directly contain values. Assigning one value type variable to another copies the contained value. This differs from the assignment of reference type variables, which copies a reference to the object but not the object itself.
With respect to derived types, how do value types differ from reference types? How are they similar?
Unlike reference types, it is not possible to derive a new type from a value type. However, like reference types, structs can implement interfaces.
How are value types initialized?
Each value type has an implicit constructor that initializes a type to it's default value.
What is the outcome of accessing the Value property of a Nullable type when its HasValue property is false?
An InvalidOperationException
exception is thrown.
Indentify the possible outcomes of the following expression that uses the null coalescing operator:

a ?? b
The result of a ?? b is a if a is non-null; otherwise, the result is b. Intuitively, b supplies the value to use when a is null.
When a is of a nullable type and b is of a non-nullable type, what type is returned from
[ a ?? b ]?
A non-nullable value, provided the appropriate implicit conversions exist between the operand types.
Describe assignment and copy semantics of reference types.
Variables of reference types, referred to as objects, store references to the actual data. So any copy or assignment copies the actual reference and not the object.
Identify the two forms of Attributes in .Net.
Attributes exist in two forms: attributes that are defined in the Common Language Runtime's base class library and custom attributes that you can create, to add extra information to your code.
What key method allows for the retrieval of information stored in custom attributes?
GetCustomAttributes
What is the base class for custom attributes?
System.Attribute
What is the purpose of the default keyword in generic code?
Specifies the default value of the type parameter. This will be null for reference types and zero for value types.
Identify the two categories of exceptions in .Net.
Exceptions generated from the CLR (SystemException) and exceptions generated from an application (ApplicationException).
How can a try catch block catch all exceptions?
Use a catch clause without parameters.

Ex.

catch
{
}
How can an exception handled by a parameter-less catch clause be re-thrown?
Use the throw statement without arguments.

Ex.

catch
{
throw;
}
What is boxing?
Packaging a value type inside a new object reference.

1. Value type moves from being stored on stack to gc heap (dynamic memory allocation)

2. Can be implicit or explicit
What is unboxing?
Extracting a value type from an object.

1. Runtime Type Checking to ensure conversion is valid.

2. Copy value from object instance to a value-type variable.
What is the purpose of the TypeForwardedToAttribute class?
Allows a type to be refactored from one assembly into another assembly, without disrupting callers compiled against the original assembly.

1. Assembly level attribute.

Ex. [assembly:TypeForwardedToAttribute(typeof(SomeType))]

Deck Info

18

permalink