logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Enumerations See What Others Are Saying!
  • Question
  • Which of the following statements are correct about an enum used inC#.NET?

    1. To use the keyword enum, we should either use [enum] or System.Enum.
    2. enum is a keyword.
    3. Enum is class declared in System.Type namespace.
    4. Enum is a class declared in the current project's root namespace.
    5. Enum is a class declared in System namespace.


  • Options
  • A. 1, 3
  • B. 2, 4
  • C. 2, 5
  • D. 3, 4

  • Correct Answer
  • 2, 5 


  • More questions

    • 1. What will be the output of the C#.NET code snippet given below?

      namespace CuriousTabConsoleApplication
      { 
          class SampleProgram
          { 
              static void Main(string[] args)
              { 
                  int[]arr = newint[]{ 1, 2, 3, 4, 5 }; 
                  fun(ref arr);
              }
              static void fun(ref int[] a)
              { 
                  for (int i = 0; i < a.Length; i++)
                  { 
                      a[i] = a[i] * 5; 
                      Console.Write(a[ i ] + " "); 
                  } 
              } 
          } 
      }

    • Options
    • A. 1 2 3 4 5
    • B. 6 7 8 9 10
    • C. 5 10 15 20 25
    • D. 5 25 125 625 3125
    • E. 6 12 18 24 30
    • Discuss
    • 2. Which of the following keyword is used to overload user-defined types by defining static member functions?

    • Options
    • A. op
    • B. opoverload
    • C. operator
    • D. operatoroverload
    • E. udoperator
    • Discuss
    • 3. Which of the following is the correct way of setting values into the structure variable e defined below?

      struct Emp
      {
          public String name;
          public int age;
          public Single sal; 
      }
      Emp e = new Emp();

    • Options
    • A.
      e.name = "Amol"; 
      e.age = 25; 
      e.sal = 5500;
    • B.
      With e
      {
          .name = "Amol";
          .age = 25;
          .sal = 5500; 
      }
    • C.
      With emp e
      {
          .name = "Amol";
          .age = 25;
          .sal = 5500; 
      }
    • D.
      e -> name = "Amol"; 
      e -> age = 25;
      e -> sal = 5500;
    • E.
      name = "Amol"; 
      age = 25;
      sal = 5500;
    • Discuss
    • 4. Which of the following should be used to implement a 'Has a' relationship between two entities?

    • Options
    • A. Polymorphism
    • B. Templates
    • C. Containership
    • D. Encapsulation
    • E. Inheritance
    • Discuss
    • 5. Which of the following statements are correct about the C#.NET code snippet given below?

      int[ , ] intMyArr = {{7, 1, 3}, {2, 9, 6}};
      1. intMyArr represents rectangular array of 2 rows and 3 columns.
      2. intMyArr.GetUpperBound(1) will yield 2.
      3. intMyArr.Length will yield 24.
      4. intMyArr represents 1-D array of 5 integers.
      5. intMyArr.GetUpperBound(0) will yield 2.

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

      namespace CuriousTabConsoleApplication
      { 
          class Sample
          { 
              int i; 
              Single j; 
              public void SetData(int i, Single j)
              { 
                  this.i = i; 
                  this.j = j;
              }
              public void Display()
              { 
                  Console.WriteLine(i + " " + j);
              } 
          } 
          class MyProgram
          { 
              static void Main(string[ ] args)
              {
                  Sample s1 = new Sample(); 
                  s1.SetData(36, 5.4f); 
                  s1.Display(); 
              } 
          } 
      }

    • Options
    • A. 0 0.0
    • B. 36 5.4
    • C. 36 5.400000
    • D. 36 5
    • E. None of the above
    • Discuss
    • 7. Which of the following is absolutely neccessary to use a class Point present in namespace Graph stored in library?

    • Options
    • A. Use fully qualified name of the Point class.
    • B. Use using statement before using the Point class.
    • C. Add Reference of the library before using the Point class.
    • D. Use using statement before using the Point class.
    • E. Copy the library into the current project directory before using the Point class.
    • Discuss
    • 8. Which of the following statements are correct about subroutines used in C#.NET?

      1. If we do not return a value from a subroutine then a value -1 gets returned.
      2. Subroutine definitions cannot be nested.
      3. Subroutine can be called recursively.
      4. To return the control from middle of a subroutine exit subroutine should be used.
      5. Subroutine calls can be nested.

    • Options
    • A. 1, 2, 3
    • B. 2, 3, 5
    • C. 3, 5
    • D. 3, 4
    • E. None of these
    • Discuss
    • 9. How many enumerators will exist if four threads are simultaneously working on an ArrayList object?

    • Options
    • A. 1
    • B. 3
    • C. 2
    • D. 4
    • E. Depends upon the Project Setting made in Visual Studio.NET.
    • Discuss
    • 10. Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea?

    • Options
    • A. Attribute
    • B. Delegate
    • C. Namespace
    • D. Interface
    • E. Encapsulation
    • Discuss


    Comments

    There are no comments.

Enter a new Comment