The document contains a reflection quiz with 40 multiple choice questions about the .NET reflection API. It covers topics like loading and accessing assemblies and types, getting metadata about members like methods and properties, working with generics, and more. The questions are intended to test understanding of reflection concepts for a class taught by Teacher Bilal Shehzad. Additional reading links are provided at the end.
1. Teacher:Bilal Shehzad
EAD REFLECTION
Presentation Topic:
Reflection(C#)
Prepared For:
Bilal Shahzad
Prepared By:
Nabell (BCSF12M060)
Sheraz Manzoor (BCSF13M009)
Arham Butt (BCSF13M025)
Farhan (BCSF13M058)
Zubair Dar (BCSF13M065)
Video link: https://youtu.be/MC1b3P4Mw3M
PUNJAB UNI COLLEGE OF INFORMATION &
TECHNOLOGY
2. Teacher:Bilal Shehzad
EAD REFLECTION
1. What can assembly do?
a. Define and load assembly
b. Define assembly
c. Load assembly
2. Which of these is true about assembly that contains the code that is
currently executing
a. var assembly = System.Reflection.Assembly (Type type);
b. var assembly = System.Reflection.Assembly.GetAssembly(Type type);
c. var assembly = System.Reflection.Assembly.GetAssembly(Type);
3. How can you load assembly
a. var assembly = System.Replection.Assembly.Load();
b. var assembly = System.Replection.Assembly.Load(string
assemblyString);
c. var assembly = System.Replection.Assembly();
4. Type class does
a. class types, enumeration types, type parameters,
b. interface types, array types
c. All of these
5. A TypeInfo instance contains:
a. definition for a Type, and a Type
b. Type
c. definition for a Type,
6. What does BindingFlags do?
a. specifies flags that control binding
b. Delete flags that control binding
c. Update flags that control binding
7. bitwise combination of its member values is aloowed by:
a. MethodInfo
b. FlagsAttribute
c. Bindingflags
8. information about the attributes of a member is obytained by
a. MethodInfo
b. FieldInfo
c. MemberInfo
9. member is a custom member type. It is specified by
a. Event
3. Teacher:Bilal Shehzad
EAD REFLECTION
b. Custom
c. Field
10.Event is a custom member type. It is specified by
a. Event
b. Custom
c. Field
11.field is a custom member type. It is specified by
a. Event
b. Custom
c. Field
12. Method Specifies that the member is a method, representing a:
a. MethodInfo member
b. MemberInfo member
c. feildInfo member
13. NestedType Specifies that the member is a nested type,
extending :
a. MethodInfo member
b. MemberInfo member
c. feildInfo member
14. Property Specifies that the member is a property, representing
a :
a. MethodInfo member
b. PropertyInfo member
c. feildInfo member
15. TypeInfo Specifies that the member is a type, representing a :
a. TypeInfo member.
b. PropertyInfo
c. MemberInfo
16. Which class discovers the attributes of a field and provides
access to field metadata.
a. MemberInfo
b. MethodInfo
c. fieldInfo
17. Which class discovers the attributes of a property and provides
access to property metadata
a. MemberInfo
4. Teacher:Bilal Shehzad
EAD REFLECTION
b. PropertyInfo
c. fieldInfo
18. Which class allows you to access a given module within a multi-
file assembly.
a. Assembly
b. Module
c. AssemblyName
19. Which class contains information for a given method.
a. Assembly
b. AssemblyName
c. MethodInfo
20. Which class holds information for a given parameter.
a. Assembly
b. Module
c. ParameterInfo
21. GetMethod() returns a
a. System.Reflection.MethodInfo object
b. EventInfo
c .PropertyInfo
22. What is system.reflection namespace hierarchy:
a. System.reflection -> MemberInfo -> Methodbase -> MethodInfo -
> .Net Reflection
b. System.reflection -> MemberInfo -> MethodInfo -> Methodbase -
> .Net Reflection
c. System.reflection -> MethodInfo -> MemberInfo -> Methodbase -
> .Net Reflection
23. The MethodInfo type allows you to obtain the method's return
value and parameter set.
a. True
b. False
24. Does reflection allows late binding?
5. Teacher:Bilal Shehzad
EAD REFLECTION
a. Yes
b. No
25. Reflection can also be used to create applications called type
browsers.
a. Yes
b. No
26.To discover information such as a parameter's name, data type,
whether a parameter is an input or output parameter,
a. PropertyInfo
b. ParameterInfo
c. MethodInfo
27.To discover information about custom attributes when you are
working in the reflection-only context of an application domain.
a. constructorInfo
b. Module
c. customerAttributeData
28.Which namespace provide a specialized form of reflection that
enables you to build types at run time.
a. System.reflection
b. System.type
c. System.Reflection.Emit
29.Locating the declaration is called Biding
a. True
b. False
30.How can you load an assembly at run time,
a. Late binding
b. Early binding
6. Teacher:Bilal Shehzad
EAD REFLECTION
c. Custom binding
31.Type.InvokeMember is used to invoke a member of a type
a. True
b. False
32.Which class is used for overload resolution and argument coercion in
methods.
a. Assembly
b. Binder
c. CustomBinder
33.ChangeType performs argument coercion (type conversion)
a. Yes
b. No
34. All code can use reflection to perform the following tasks:
a. Enumerate types and members, and examine their metadata.
b. Enumerate and examine assemblies and modules.
c. Both a & b
35.In reflection isSecurityCritical?
a. Yes
b. No
36.How to Get an array that contains the generic type arguments, using
the GetGenericArguments method.
a.Type[] typeParameters =
t.GetGenericArguments(type);
b.Type[] typeParameters = t.GetGenericArguments();
c.Type[] typeParameters = t.GetGenericArguments(t);
37.Can you create an instance of generic type?
a. Yes
b. No
7. Teacher:Bilal Shehzad
EAD REFLECTION
38.How can you determine whether type is generic or not?
a. By using IsGenericType
b. By using IsGenericMethod
c. By using MethodInfo
39.From where generic type Parameter might come
a. from an enclosing type,
b. from a generic method
c. Both a&b
40.Can we
use Type.GetGenericArguments and MethodInfo.GetGenericArgume
nts to obtain an array of Type objects that represent the type
parameters or type arguments of a generic type,
a. Yes
b. No