logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Arrays See What Others Are Saying!
  • Question
  • Which of the following are the correct ways to define an array of 2 rows and 3 columns?

    1. int[ , ] a;
      a = new int[2, 3]{{7, 1, 3},{2, 9, 6}};
    2. int[ , ] a;
      a = new int[2, 3]{};
    3. int[ , ] a = {{7, 1, 3}, {2, 9,6 }};
    4. int[ , ] a;
      a = new int[1, 2];
    5. int[ , ] a;
      a = new int[1, 2]{{7, 1, 3}, {2, 9, 6}};


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

  • Correct Answer
  • 1, 3 


  • More questions

    • 1. Which of the following CANNOT belong to a C#.NET Namespace?

    • Options
    • A. class
    • B. struct
    • C. enum
    • D. Data
    • E. interface
    • Discuss
    • 2. A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

    • Options
    • A. 12 bytes
    • B. 24 bytes
    • C. 0 byte
    • D. 8 bytes
    • E. 16 bytes
    • Discuss
    • 3. Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?

    • Options
    • A. new
    • B. base
    • C. overloads
    • D. override
    • E. overridable
    • Discuss
    • 4. Which of the following statements are correct about an interface in C#.NET?

      1. A class can implement multiple interfaces.
      2. Structures cannot inherit a class but can implement an interface.
      3. In C#.NET, : is used to signify that a class member implements a specific interface.
      4. An interface can implement multiple classes.
      5. The static attribute can be used with a method that implements an interface declaration.

    • Options
    • A. 1, 2, 3
    • B. 2, 4
    • C. 3, 5
    • D. None of the above.
    • Discuss
    • 5. Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?

    • Options
    • A. Polymorphism
    • B. Containership
    • C. Templates
    • D. Encapsulation
    • E. Inheritance
    • Discuss
    • 6. Which of the following is NOT an Exception?

    • Options
    • A. StackOverflow
    • B. Division By Zero
    • C. Insufficient Memory
    • D. Incorrect Arithmetic Expression
    • E. Arithmetic overflow or underflow
    • Discuss
    • 7. Which of the following can implement an interface?

      1. Data
      2. Class
      3. Enum
      4. Structure
      5. Namespace

    • Options
    • A. 1, 3
    • B. 2, 4
    • C. 3, 5
    • D. 4 only
    • Discuss
    • 8. It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.

    • Options
    • A. True
    • B. False
    • Discuss
    • 9. 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
    • 10. 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


    Comments

    There are no comments.

Enter a new Comment