C# Questions & Answers on Attributes for Freshers

1. Which of the following cannot further inspect the attribute that is once applied?

a) Linker
b) ASP.NET Runtime
c) Language compilers
d) CLR
Answer: a
2. To apply an attribute to an Assembly, the correct way of implementation is?

a) [AssemblyInfo: AssemblyDescription (“Csharp”)].
b) [assembly: AssemblyDescription(“Csharp”)].
c) [AssemblyDescription(“Csharp”)].
d) (Assembly:AssemblyDescription(“Csharp”)].
Answer: b
3. The correct method to pass parameter to an attribute is?

a) By name
b) By address
c) By value
d) By reference
Answer: a
4. Which among the following is the correct form of applying an attribute?
a)<Serializable()>class sample
  {
 
  }
b)(Serializable())class sample
  {
 
  }
c)[Serializable()] class sample
  {
 
  }
d) None of the mentioned
Answer: c
Explanation: By definition.

5. Which among the following cannot be a target for a custom attribute?

a) Enum
b) Event
c) Interface
d) Namespace
Answer: d
6. Select the correct statement about Attributes used in C#.NET?

a) The CLR can change the behaviour of the code depending on attributes applied to it
b) If a bugFixAttribute is to recieve three paramteres, then the BugFixAttribute class should implement a zero arguement constructor
c) To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute
d) None of the mentioned
Answer: a
7. The correct way to apply the custom attribute called Employer which receives two arguements – name of the employee and employeeid is?

a) Custom attribute can be applied to an assembly
b) [assembly : Employer(“Ankit”,employeeid.one)].
c) [ Employer(“Ankit”, employeeid.second)] class employee
{
}
d) All of the mentioned
Answer: d
8. Which of the following is the correct statement about inspecting an attribute in C#.NET?

a) An attribute can be inspected at link time
b) An attribute can be inspected at design time
c) An attribute can be inspected at run time
d) None of the mentioned
Answer: a
9. Attributes could be applied to

a) Method
b) Class
c) Assembly
d) All of the mentioned
Answer: d
10. The [Serializable()] attributes gets inspected at:

a) compile time
b) run time
c) design time
d) linking time
Answer: b

Related

Computer Fundamentals Multiple choice Questions and Answers on Virtual Reality for Freshers

1. HMD stands for? a) Head Mounted Displayb) Head Masked Displayc) Head Made Displayd) Head Mounted Detection Answer: a Explanation: It stands for Head Mounted Display. A kind of stereo display w...

Computer Fundamentals Multiple choice Questions and Answers on Graphics Media for Freshers

1. The media texts may throw up discourses and are called ____________ a) Binary oppositionsb) Violationsc) Oppositionsd) Media Illiteracy Answer: a Explanation: Some texts may also throw up disc...

Computer Fundamentals Multiple choice Questions and Answers on Text Media for Freshers

1. ______________the ability to access, analyzes, evaluate and produce media. a) Literacyb) Internetc) Mediad) Media Literacy Answer: d Explanation: It is media literacy. It is the ability to acc...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item