logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Enumerations See What Others Are Saying!
  • Question
  • Which of the following CANNOT be used as an underlying datatype for an enum in C#.NET?


  • Options
  • A. byte
  • B. short
  • C. float
  • D. int

  • Correct Answer
  • float 


  • More questions

    • 1. Which of the following statements are correct about functions and subroutines used in C#.NET?

      1. A function cannot be called from a subroutine.
      2. The ref keyword causes arguments to be passed by reference.
      3. While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control passes back to the calling method.
      4. A subroutine cannot be called from a function.
      5. Functions and subroutines can be called recursively.

    • Options
    • A. 1, 2, 4
    • B. 2, 3, 5
    • C. 3, 5
    • D. 4, 5
    • E. None of these
    • Discuss
    • 2. If a function fun() is to receive an int, a Single & a double and it is to return a decimal then which of the following is the correct way of defining this function?

    • Options
    • A.
      decimal static fun(int i, Single j, double k)
      { ... }
    • B.
      decimal fun(int i, Single j, double k)
      { ... }
    • C.
      static decimal fun(int i, Single j, double k)
      { ... }
    • D.
      static decimal fun(int i, Single j, double k) decimal
      { ... }
    • E.
      static fun(int i, Single j, double k)
      { 
          ... 
          return decimal;
      }
    • Discuss
    • 3. What is the size of a Decimal?

    • Options
    • A. 4 byte
    • B. 8 byte
    • C. 16 byte
    • D. 32 byte
    • Discuss
    • 4. Which of the following is the correct way to call subroutine MyFun() of the Sample class given below?

      class Sample
      {
          public void MyFun(int i, Single j)
          {
              Console.WriteLine("Welcome to CuriousTab !");
          }
      }

    • Options
    • A.
      delegate void del(int i);
      Sample s = new Sample();
      del d = new del(ref s.MyFun);
      d(10, 1.1f);
    • B.
      delegate void del(int i, Single j);
      del d;
      Sample s = new Sample();
      d = new del(ref s.MyFun);
      d(10, 1.1f);
    • C.
      Sample s = new Sample();
      delegate void d = new del(ref MyFun);
      d(10, 1.1f);
    • D.
      delegate void del(int i, Single]);
      Sample s = new Sample();
      del = new delegate(ref MyFun);
      del(10, 1.1f);
    • Discuss
    • 5. Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparision function?

    • Options
    • A. Namespace
    • B. Interface
    • C. Encapsulation
    • D. Delegate
    • E. Attribute
    • Discuss
    • 6. What will be the output of the C#.NET code snippet given below?

      namespace CuriousTabConsoleApplication
      {
          class SampleProgram
          {
              static void Main(string[ ] args)
              {
                  object[] o = new object[] {"1", 4.0, "India", 'B'};
                  fun (o);
              }
              static void fun (params object[] obj)
              {
                  for (int i = 0; i < obj.Length-1; i++)
                  Console.Write(obj[i] + " ");
              }
          }
      }

    • Options
    • A. 1 4.0 India B
    • B. 1 4.0 India
    • C. 1 4 India
    • D. 1 India B
    • Discuss
    • 7. Which of the following is the correct way to obtain the number of elements present in the array given below?

          int[] intMyArr = {25, 30, 45, 15, 60};
      1. intMyArr.GetMax;
      2. intMyArr.Highest(0);
      3. intMyArr.GetUpperBound(0);
      4. intMyArr.Length;
      5. intMyArr.GetMaxElements(0);

    • Options
    • A. 1, 2
    • B. 3, 4
    • C. 3, 5
    • D. 1, 5
    • E. 4, 5
    • Discuss
    • 8. What will be the output of the C#.NET code snippet given below?

      namespace CuriousTabConsoleApplication
      {
          class SampleProgram
          {
              static void Main(string[ ] args)
              {
                  int i;
                  int res = fun(out i);
                  Console.WriteLine(res);
              }
              static int fun (out int i)
              {
                  int s = 1;
                  i = 7;
                  for(int j = 1; j <= i; j++)
                  {
                      s = s * j;
                  }
                  return s;
              } 
          } 
      }

    • Options
    • A. 1
    • B. 7
    • C. 8
    • D. 720
    • E. 5040
    • Discuss
    • 9. Which of the following statements is correct?

    • Options
    • A. Static methods can be a virtual method.
    • B. Abstract methods can be a virtual method.
    • C. It is necessary to override a virtual method.
    • D. When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overriden.
    • E. We can override virtual as well as non-virtual methods.
    • Discuss
    • 10. In a HashTable Key cannot be null, but Value can be.

    • Options
    • A. True
    • B. False
    • Discuss


    Comments

    There are no comments.

Enter a new Comment