logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Functions and Subroutines See What Others Are Saying!
  • Question
  • If a function fun() is to sometimes receive an int and sometimes a double then which of the following is the correct way of defining this function?


  • Options
  • A.
    static void fun(object i)
    { ... }
  • B.
    static void fun(int i)
    { ... }
  • C.
    static void fun(double i, int j)
    { ... }
  • D.
    static void fun(int i, double j)
    { ... }
  • E.
    static void fun(int i, double j, )
    { ... }

  • Correct Answer
  • static void fun(object i)
    { ... }
     


  • More questions

    • 1. Which of the following will be the correct output for the C#.NET program given below?

      namespace CuriousTabConsoleApplication
      { 
          class SampleProgram
          {
              static void Main(string[] args)
              { 
                  int num = 1;
                  funcv(num); 
                  Console.Write(num + ", "); 
                  funcr(ref num); 
                  Console.Write(num + ", ");
              }
              static void funcv(int num)
              { 
                  num = num + 10; Console.Write(num + ", ");
              }
              static void funcr (ref int num)
              { 
                  num = num + 10; Console.Write(num + ", ");
              } 
          } 
      }

    • Options
    • A. 1, 1, 1, 1,
    • B. 11, 1, 11, 11,
    • C. 11, 11, 11, 11,
    • D. 11, 11, 21, 11,
    • E. 11, 11, 21, 21,
    • Discuss
    • 2. Which of the following operators cannot be overloaded?

      1. true
      2. false
      3. new
      4. ~
      5. sizeof

    • Options
    • A. 1, 3
    • B. 2, 4
    • C. 3, 5
    • D. All of the above
    • Discuss
    • 3. Which of the following is the correct output for the C#.NET program given below?

      int i = 20 ;
      for( ; ; )
      {
          Console.Write(i + " "); 
          if (i >= -10)
              i -= 4; 
          else 
              break;
      }

    • Options
    • A. 20 16 12 84 0 -4 -8
    • B. 20 16 12 8 4 0
    • C. 20 16 12 8 4 0 -4 -8 -12
    • D. 16 12 8 4 0
    • E. 16 8 0 -8
    • Discuss
    • 4. In an inheritance chain which of the following members of base class are accessible to the derived class members?

      1. static
      2. protected
      3. private
      4. shared
      5. public

    • Options
    • A. 1, 3
    • B. 2, 5
    • C. 3, 4
    • D. 4, 5
    • Discuss
    • 5. Which of the following are value types?

      1. Integer
      2. Array
      3. Single
      4. String
      5. Long

    • Options
    • A. 1, 2, 5
    • B. 1, 3, 5
    • C. 2, 4
    • D. 3, 5
    • Discuss
    • 6. Which of the following CANNOT occur multiple number of times in a program?

    • Options
    • A. namespace
    • B. Entrypoint
    • C. Class
    • D. Function
    • E. Subroutine
    • Discuss
    • 7. Which of the following statement correctly assigns a value 33 to a variable c?

      byte a = 11, b = 22, c;


    • Options
    • A. c = (byte) (a + b);
    • B. c = (byte) a + (byte) b;
    • C. c = (int) a + (int) b;
    • D. c = (int)(a + b);
    • E. c = a + b;
    • Discuss
    • 8. An enum can be declared inside a class, struct, namespace or interface.

    • Options
    • A. True
    • B. False
    • Discuss
    • 9. Which of the following statements are correct about the Collection Classes available in Framework Class Library?

    • Options
    • A. Elements of a collection cannot be transmitted over a network.
    • B. Elements stored in a collection can be retrieved but cannot be modified.
    • C. It is not easy to adopt the existing Collection classes for newtype of objects.
    • D. Elements stored in a collection can be modified only if allelements are of similar types.
    • E. They use efficient algorithms to manage the collection, thereby improving the performance of the program.
    • Discuss
    • 10. Which of the following statements is correct about a namespace used in C#.NET?

    • Options
    • A. Nested namespaces are not allowed.
    • B. Importing outer namespace imports inner namespace.
    • C. Nested namespaces are allowed.
    • D. If nested, the namespaces cannot be split across files.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment