logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Polymorphism See What Others Are Saying!
  • Question
  • Which of the following modifier is used when a virtual method is redefined by a derived class?


  • Options
  • A. overloads
  • B. override
  • C. overridable
  • D. virtual
  • E. base

  • Correct Answer
  • override 


  • More questions

    • 1. Which of the following statements are correct about constructors in C#.NET?

      1. Constructors cannot be overloaded.
      2. Constructors always have the name same as the name of the class.
      3. Constructors are never called explicitly.
      4. Constructors never return any value.
      5. Constructors allocate space for the object in memory.

    • Options
    • A. 1, 3, 5
    • B. 2, 3, 4
    • C. 3, 5
    • D. 4, 5
    • E. None of these
    • Discuss
    • 2. Which of the following statements is incorrect about a delegate?

    • Options
    • A. A single delegate can invoke more than one method.
    • B. Delegates can be shared.
    • C. Delegate is a value type.
    • D. Delegates are type-safe wrappers for function pointers.
    • E. The signature of a delegate must match the signature of the method that is to be called using it.
    • Discuss
    • 3. What will be the output of the C#.NET code snippet given below?

      namespace CuriousTabConsoleApplication
      {
          class Sample
          { 
              public static void fun1()
              { 
                  Console.WriteLine("CuriousTab1 method");
              }
              public void fun2()
              { 
                  fun1(); 
                  Console.WriteLine("CuriousTab2 method");
              }
              public void fun2(int i)
              { 
                  Console.WriteLine(i);
                  fun2(); 
              } 
          } 
          class MyProgram
          { 
              static void Main(string[ ] args)
              { 
                  Sample s = new Sample(); 
                  Sample.fun1(); 
                  s.fun2(123);
              } 
          } 
      }

    • Options
    • A.
      Tab1 method 
      123
      Tabl method 
      Tab2 method
    • B.
      Tab1 method 
      123
      Tab2 method
    • C.
      Tab2 method 
      123
      Tab2 method 
      Tabl method
    • D.
      Tabl method
      123
    • E.
      Tab2 method 
      123
      Tabl method
    • Discuss
    • 4. Which of the following is the correct way to implement a write only property Length in a Sample class?

    • Options
    • A.
      class Sample
      {
          public int Length
          {
              set
              {
                  Length = value;
              } 
          } 
      }
    • B.
      class Sample
      {
          int len;
          public int Length
          {
              get
              {
                  return len;
              }
              set
              {
                  len = value;
              } 
          } 
      }
    • C.
      class Sample
      {
          int len;
          public int Length
          {
              WriteOnly set
              {
                  len = value;
              } 
          } 
      }
    • D.
      class Sample
      {
          int len;
          public int Length
          {
              set
              {
                  len = value;
              }
          } 
      }
    • Discuss
    • 5. Which of the following statements are correct about an enum used in C#.NET?

      1. An enum can be declared inside a class.
      2. An enum can take Single, Double or Decimal values.
      3. An enum can be declared outside a class.
      4. An enum can be declared inside/outside a namespace.
      5. An object can be assigned to an enum variable.

    • Options
    • A. 1, 3, 4
    • B. 2, 5
    • C. 3, 4
    • D. 2, 4, 5
    • Discuss
    • 6. Which of the following is the necessary condition for implementing delegates?

    • Options
    • A. Class declaration
    • B. Inheritance
    • C. Run-time Polymorphism
    • D. Exceptions
    • E. Compile-time Polymorphism
    • Discuss
    • 7. Suppose value of the Capacity property of ArrayList Collection is set to 4. What will be the capacity of the Collection on adding fifth element to it?

    • Options
    • A. 4
    • B. 8
    • C. 16
    • D. 32
    • Discuss
    • 8. Which of the following is the correct output for the C#.NET code snippet given below?

      Console.WriteLine(13 / 2 + " " + 13 % 2); 

    • Options
    • A. 6.5 1
    • B. 6.5 0
    • C. 6 0
    • D. 6 1
    • E. 6.5 6.5
    • Discuss
    • 9. Which of the following statements are correct about the C#.NET code snippet given below?

         int[][]intMyArr = new int[2][]; 
         intMyArr[0] = new int[4]{6, 1, 4, 3}; 
         intMyArr[1] = new int[3]{9, 2, 7};

    • Options
    • A. intMyArr is a reference to a 2-D jagged array.
    • B. The two rows of the jagged array intMyArr are stored in adjacent memory locations.
    • C. intMyArr[0] refers to the zeroth 1-D array and intMyArr[1] refers to the first 1-D array.
    • D. intMyArr refers to intMyArr[0] and intMyArr[1].
    • E. intMyArr refers to intMyArr[1] and intMyArr[2].
    • Discuss
    • 10. Which of the following is an 8-byte Integer?

    • Options
    • A. Char
    • B. Long
    • C. Short
    • D. Byte
    • E. Integer
    • Discuss


    Comments

    There are no comments.

Enter a new Comment