logo

CuriousTab

CuriousTab

Discussion


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

    1. An interface can contain properties, methods and events.
    2. The keyword must implement forces implementation of an interface.
    3. Interfaces can be overloaded.
    4. Interfaces can be implemented by a class or a struct.
    5. Enhanced implementations of an interface can be developed without breaking existing code.


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

  • Correct Answer
  • 1, 4, 5 


  • More questions

    • 1. Which of the following is the correct way to define and initialise an array of 4 integers?

      1. int[] a = {25, 30, 40, 5};
      2. int[] a;
        a = new int[3];
        a[0] = 25;
        a[1] = 30;
        a[2] = 40;
        a[3] = 5;
      3. int[] a;
        a = new int{25, 30, 40, 5};
      4. int[] a;
        a = new int[4]{25, 30, 40, 5};
      5. int[] a;
        a = new int[4];
        a[0] = 25;
        a[1] = 30;
        a[2] = 40;
        a[3] = 5;

    • Options
    • A. 1, 2
    • B. 3, 4
    • C. 1, 4, 5
    • D. 2, 4, 5
    • E. 2, 5
    • Discuss
    • 2. Which of the following is NOT an interface declared in System.Collections namespace?

    • Options
    • A. IComparer
    • B. IEnumerable
    • C. IEnumerator
    • D. IDictionaryComparer
    • E. IDictionaryEnumerator
    • Discuss
    • 3. Which of the following will be the correct output for the C#.NET code snippet given below?

      String s1 = "ALL MEN ARE CREATED EQUAL";
      String s2;
      s2 = s1.Substring(12, 3); 
      Console.WriteLine(s2);

    • Options
    • A. ARE
    • B. CRE
    • C. CR
    • D. REA
    • E. CREATED
    • Discuss
    • 4. What will be the output of the C#.NET code snippet given below?

      namespace CuriousTabConsoleApplication
      {
          class SampleProgram
          {
              static void Main(string[ ] args)
              {
                  int i = 10;
                  double d = 34.340;
                  fun(i);
                  fun(d);
              }
              static void fun(double d)
              {
                  Console.WriteLine(d + " ");
              }
          }
      }

    • Options
    • A. 10.000000 34.340000
    • B. 10 34
    • C. 10 34.340
    • D. 10 34.34
    • Discuss
    • 5. Which of the following statements is correct?

    • Options
    • A. It is not possible to extend the if statement to handle multiple conditions using the else-if arrangement.
    • B. The switch statement can include any number of case instances with two case statements having the same value.
    • C. A jump statement such as a break is required after each case block excluding the last block if it is a default statement.
    • D. The if statement selects a statement for execution based on the value of a Boolean expression.
    • E. C# always supports an implicit fall through from one case label to another.
    • Discuss
    • 6. 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
    • Discuss
    • 7. Which of the following statements is correct?

    • Options
    • A. There is one garbage collector per program running in memory.
    • B. There is one common garbage collector for all programs.
    • C. An object is destroyed by the garbage collector when only one reference refers to it.
    • D. We have to specifically run the garbage collector after executing Visual Studio.NET.
    • Discuss
    • 8. Which of the following statements is correct?

    • Options
    • A. A struct never declares a default constructor.
    • B. All value types in C# inherently derive from ValueType, which inherits from Object.
    • C. A struct never declares a default destructor.
    • D. In C#, classes and structs are semantically same.
    • Discuss
    • 9. Which of the following statements are correct about Structures used in C#.NET?

      1. A Structure can be declared within a procedure.
      2. Structs can implement an interface but they cannot inherit from another struct.
      3. struct members cannot be declared as protected.
      4. A Structure can be empty.
      5. It is an error to initialize an instance field in a struct.

    • Options
    • A. 1, 2, 4
    • B. 2, 3, 5
    • C. 2, 4
    • D. 1, 3
    • Discuss
    • 10. Which of the following statements is correct about properties used in C#.NET?

    • Options
    • A. A property can simultaneously be read only or write only.
    • B. A property can be either read only or write only.
    • C. A write only property will have only get accessor.
    • D. A write only property will always return a value.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment