C# Programming - Functions and Subroutines

Exercise :: Functions and Subroutines - General Questions

  • Functions and Subroutines - General Questions
11. 

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

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

A. 1, 2, 5
B. 2, 3, 5
C. 2, 3
D. 4, 5
E. None of these

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

12. 

How many values is a function capable of returning?

A. 1
B. 0
C. Depends upon how many params arguments does it use.
D. Any number of values.
E. Depends upon how many ref arguments does it use.

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

13. 

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

namespace IndiabixConsoleApplication
{
    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] + " ");
        }
    }
}

A. 1 4.0 India B
B. 1 4.0 India
C. 1 4 India
D. 1 India B

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.

14. 

How many values is a subroutine capable of returning?

A. Depends upon how many params arguments does it use.
B. Any number of values.
C. Depends upon how many ref arguments does it use.
D. 0
E. 1

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.

15. 

Which of the following CANNOT occur multiple number of times in a program?

A. namespace
B. Entrypoint
C. Class
D. Function
E. Subroutine

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.