logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Attributes See What Others Are Saying!
  • Question
  • The [Serializable()] attribute gets inspected at


  • Options
  • A. Compile-time
  • B. Run-time
  • C. Design-time
  • D. Linking-time
  • E. None of the above

  • Correct Answer
  • Run-time 


  • More questions

    • 1. Which of the following statements is correct about the C#.NET program given below?

      namespace CuriousTabConsoleApplication
      {
          class Baseclass
          { 
              int i;
              public Baseclass(int ii)
              {
                  i = ii;
                  Console.Write("Base "); 
              } 
          } 
          class Derived : Baseclass
          {
              public Derived(int ii) : base(ii)
              {
                  Console.Write("Derived ");
              } 
          } 
          class MyProgram
          { 
              static void Main(string[ ] args)
              { 
                  Derived d = new Derived(10);
              } 
          } 
      }

    • Options
    • A. The program will work correctly only if we implement zero-argument constructors in Baseclass as well as Derived class.
    • B. The program will output: Derived Base
    • C. The program will report an error in the statement base(ii).
    • D. The program will work correctly if we replace base(ii) with base.Baseclass(ii).
    • E. The program will output: Base Derived
    • Discuss
    • 2. Multiple inheritance is different from multiple levels of inheritance.

    • Options
    • A. True
    • B. False
    • Discuss
    • 3. Which of the following is NOT a .NET Exception class?

    • Options
    • A. Exception
    • B. StackMemoryException
    • C. DivideByZeroException
    • D. OutOfMemoryException
    • E. InvalidOperationException
    • Discuss
    • 4. Which of the followings is the correct way to overload + operator?

    • Options
    • A.
      public sample operator + ( sample a, sample b )
    • B.
      public abstract operator + ( sample a, sample b)
    • C.
      public abstract sample operator + (sample a, sample b )
    • D.
      public static sample operator + ( sample a, sample b )
    • E. All of the above
    • Discuss
    • 5. A property can be declared inside a namespace or a procedure.

    • Options
    • A. True
    • B. False
    • Discuss
    • 6. How many times can a constructor be called during lifetime of the object?

    • Options
    • A. As many times as we call it.
    • B. Only once.
    • C. Depends upon a Project Setting made in Visual Studio.NET.
    • D. Any number of times before the object gets garbage collected.
    • E. Any number of times before the object is deleted.
    • Discuss
    • 7. 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?

      1. Custom attribute cannot be applied to an assembly.
      2. [assembly: Tested("Sachin", testgrade.Good)]
      3. [Tested("Virat", testgrade.Excellent)]
        class customer { /* .... */ }
      4. Custom attribute cannot be applied to a method.
      5. Custom attribute cannot be applied to a class.

    • Options
    • A. 1 only
    • B. 1, 5
    • C. 2, 3
    • D. 4, 5
    • E. None of the above
    • Discuss
    • 8. Which of the following statements are correct about Attributes used in C#.NET?

    • Options
    • A. If there is a custom attribute BugFixAttribute then the compiler will look ONLY for the BugFix attribute in the code that uses this attribute.
    • B. To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute.
    • C. To create a custom attribute we need to create a class and implement IAttribute interface in it.
    • D. If a BugFixAttribute is to receive three parameters then the BugFixAttribute class should implement a zero-argument constructor.
    • E. The CLR can change the behaviour of the code depending upon the attributes applied to it.
    • Discuss
    • 9. Which of the following is the correct output of the C#.NET code snippet given below?

          int[][] a = new int[2][];
          a[0] = new int[4]{6, 1, 4, 3};
          a[1] = new int[3]{9, 2, 7}; 
          Console.WriteLine(a[1].GetUpperBound(0));

    • Options
    • A. 3
    • B. 4
    • C. 7
    • D. 9
    • E. 2
    • Discuss
    • 10. Attributes can be applied to

      1. Method
      2. Class
      3. Assembly
      4. Namespace
      5. Enum

    • Options
    • A. 1 and 2 only
    • B. 1, 2 and 3
    • C. 4 and 5 only
    • D. All of the above
    • E. None of the above
    • Discuss


    Comments

    There are no comments.

Enter a new Comment