d. System.CodeDom
c. x => x * x;
b. Create an instance of the Assembly class, load the assembly, and call the GetReferencedAssemblies method.
d. Type myType = myParameter.GetType();
b. class MyCustomAttribute : System.Attribute
{
public string Version { get; set; }
}b. Assembly
c. GetExportedTypes
d. FullName
a. GetExecutingAssembly
a. Assembly.Load(“System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”);
b. Assembly.LoadFrom(@”c:\MyProject\
Project1.dll”);
c. Assembly.LoadFile(@”c:\MyProject\
Project1.dll”);
d. Assembly.ReflectionOnlyLoad((“System.Data,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089”);
c. Load
b. LoadFrom
a. myAssembly.CreateInstance
(“System.Data.DataTable”);
d. Type
a. Create an instance of the Type class using the typeof keyword and then examine the IsPublic property of the Type variable.
b. FieldInfo
d. GetArrayRank
a. myClass.GetType().GetField
(“myPrivateField”, BindingFlags.NonPublic |
BindingFlags.Instance)
b. Invoke
20. Which statement uses reflection to execute the method and passes in two parameters given the following code block?
MyClass myClass = new MyClass();
MethodInfo myMethod = typeof(MyClass).GetMethod(“Multiply”);
a. myMethod.Execute(myClass, new object[] { 4,
5 });
b. myMethod.Execute(MyClass, new object[] { 4,
5 });
c. myMethod.Invoke(myClass, new object[] { 4,
5 });
d. myMethod.Invoke(MyClass, new object[] { 4,
5 });c. myMethod.Invoke(myClass, new object[] { 4,
5 });
E1. Which class name follows the standard naming convention for a custom attribute class?
a. AttributeMyCustom
b. MyCustomAttribute
c. MyCustom
d. MyCustom_Attribute
b. MyCustomAttribute
E2. How can you limit the scope of a custom attribute that you are creating so that it can be used only by a class?
a. Set the custom attribute’s TargetLevel property to Class.
b. Add the following attribute above the custom attribute’s class declaration:
[System.AttributeUsage(AttributeTargets.Class)]
c. Set the custom attribute’s TargetLevel attribute to Class.
d. Set the custom attribute’s Scope property to Class.
b. Add the following attribute above the custom attribute’s class declaration:
E3. If you have created a custom attribute class called DataMappingAttribute and have used it in a class called Person, which statement will return all the DataMappingAttributes that have been applied to the Person class? a. typeof(DataMappingAttribute). GetCusomAttributes(typeof(Person), false); b. typeof(Person).GetAttributes(typeof (DataMappingAttribute), false); c. typeof(DataMappingAttribute). GetAttributes(typeof(Person), false); d. typeof(Person).GetCusomAttributes (typeof(DataMappingAttribute), false);
d. typeof(Person).GetCusomAttributes
(typeof(DataMappingAttribute), false);
E4. Which class in the CodeDOM is the top-level class that is the container for all other objects within the class?
a. CodeNamespace
b. CodeCompileUnit
c. CodeConstructor
d. CodeDOMProvider
b. CodeCompileUnit