logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Delegates See What Others Are Saying!
  • Question
  • In which of the following areas are delegates commonly used?

    1. Remoting
    2. Serialization
    3. File Input/Output
    4. Multithreading
    5. Event handling


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

  • Correct Answer
  • 4 and 5 only 


  • More questions

    • 1. Which of the following statements are correct about data types?

      1. If the integer literal exceeds the range of byte, a compilation error will occur.
      2. We cannot implicitly convert non-literal numeric types of larger storage size to byte.
      3. Byte cannot be implicitly converted to float.
      4. A char can be implicitly converted to only int data type.
      5. We can cast the integral character codes.

    • Options
    • A. 1, 3, 5
    • B. 2, 4
    • C. 3, 5
    • D. 1, 2, 5
    • Discuss
    • 2. Which of the following will be the correct output for the C#.NET code snippet given below?

      enum color : int
      {
          red = -3,
          green,
          blue 
      }
      Console.Write( (int) color.red + ", "); 
      Console.Write( (int) color.green + ", "); 
      Console.Write( (int) color.blue );

    • Options
    • A. -3, -2, -1
    • B. -3, 0, 1
    • C. 0, 1, 2
    • D. red, green, blue
    • E. color.red, color.green, color.blue
    • Discuss
    • 3. There is no multiple inheritance in C#.NET. That is, a class cannot be derived from multiple base classes.

    • Options
    • A. True
    • B. False
    • Discuss
    • 4. Which of the following statements are correct about the C#.NET code snippet given below?

      class Sample
      {
          static int i;
          int j;
          public void proc1()
          {
              i = 11; 
              j = 22;
          }
          public static void proc2()
          {
              i = 1;
              j = 2;
          }
          static Sample()
          {
              i = 0; 
              j = 0;
          }
      }

    • Options
    • A. i cannot be initialized in proc1().
    • B. proc1() can initialize i as well as j.
    • C. j can be initialized in proc2().
    • D. The constructor can never be declared as static.
    • E. proc2() can initialize i as well as j.
    • Discuss
    • 5. Which of the following statements is correct?

    • Options
    • A. A constructor can be used to set default values and limit instantiation.
    • B. C# provides a copy constructor.
    • C. Destructors are used with classes as well as structures.
    • D. A class can have more than one destructor.
    • Discuss
    • 6. A Student class has a property called rollNo and stu is a reference to a Student object and we want the statement stu.RollNo = 28 to fail. Which of the following options will ensure this functionality?

    • Options
    • A. Declare rollNo property with both get and set accessors.
    • B. Declare rollNo property with only set accessor.
    • C. Declare rollNo property with get, set and normal accessors.
    • D. Declare rollNo property with only get accessor.
    • E. None of the above
    • Discuss
    • 7. Which of the following is the correct way to apply an attribute to an Assembly?

    • Options
    • A. [ AssemblyDescription("DCube Component Library") ]
    • B. [ assembly : AssemblyDescription("DCube Component Library") ]
    • C. [ Assemblylnfo : AssemblyDescription("DCube Component Library") ]
    • D. < Assembly: AssemblyDescription("DCube Component Library") >
    • E. (Assembly: AssemblyDescription("DCube Component Library"))
    • Discuss
    • 8. Which of the following are correct ways to specify the targets for a custom attribute?

    • Options
    • A. By applying AttributeUsage to the custom attribute's class definition.
    • B. By applying UsageAttribute to the custom attribute's class definition.
    • C. Once an attribute is declared it applies to all the targets.
    • D. By applying AttributeUsageAttribute to the custom attribute's class definition.
    • E. None of the above.
    • Discuss
    • 9. Which of the following is the correct way to define a variable of the type struct Emp declared below?

      struct Emp
      {
          private String name; 
          private int age; 
          private Single sal;
      }
      1. Emp e(); e = new Emp();
      2. Emp e = new Emp;
      3. Emp e; e = new Emp;
      4. Emp e = new Emp();
      5. Emp e;

    • Options
    • A. 1, 3
    • B. 2, 5
    • C. 4, 5
    • D. 1, 2, 4
    • Discuss
    • 10. If Sample class has a Length property with set accessor then which of the following statements will work correctly?

    • Options
    • A.
      Sample m = new Sample(); 
      int l;
      l = m.Length;
    • B.
      Sample m = new Sample(); 
      m.Length = m.Length + 20;
    • C.
      Sample.Length = 20;
    • D.
      Console.WriteLine (Sample.Length);
    • E.
      Sample m = new Sample(); 
      m.Length = 10;
    • Discuss


    Comments

    There are no comments.

Enter a new Comment