C# - Attributes Question and Answer
C# - Attributes Question and Answer
11. Which of the following is the correct way to apply an attribute to an Assembly?
- [ AssemblyDescription("DCube Component Library") ]
- [ assembly : AssemblyDescription("DCube Component Library") ]
- [ Assemblylnfo : AssemblyDescription("DCube Component Library") ]
- < Assembly: AssemblyDescription("DCube Component Library") >
12. Which of the following is the correct way of applying the custom attribute called Tested which receives two-arguments - name of the tester and the testgrade?
Custom attribute cannot be applied to an assembly.
[assembly: Tested("Sachin", testgrade.Good)]
[Tested("Virat", testgrade.Excellent)]
class customer { /* .... */ }
Custom attribute cannot be applied to a method.
Custom attribute cannot be applied to a class
Custom attribute cannot be applied to an assembly.
[assembly: Tested("Sachin", testgrade.Good)]
[Tested("Virat", testgrade.Excellent)]
class customer { /* .... */ }
Custom attribute cannot be applied to a method.
Custom attribute cannot be applied to a class
- 1 only
- 1, 5
- 2, 3
- 4, 5
13. Attributes can be applied to
Method
Class
Assembly
Namespace
Enum
Method
Class
Assembly
Namespace
Enum
- 1 and 2 only
- 1, 2 and 3
- 4 and 5 only
- All of the above