Friday, 16 December 2011

69.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

68.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

67.Which of the following statements are correct?

1.C# allows a function to have arguments with default values.
2.C# allows a function to have variable number of arguments.
3.Omitting the return value type in method definition results into an exception.
4.Redefining a method parameter in the method's body causes an exception.
5.params is used to specify the syntax for a function with variable number of arguments.
A.1, 3, 5
B.3, 4, 5
C.2, 5
D.4, 5
E.None of these
Answer: Option C

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

namespace IndiabixConsoleApplication
{
    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 + " ");
        }
    }
}
A.10.000000 34.340000
B.10 34
C.10 34.340
D.10 34.34
Answer: Option D

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

namespace IndiabixConsoleApplication
{
    class SampleProgram
    {
        static void Main(string[] args)
        {
            int a = 5;
            int s = 0, c = 0;
            Proc(a, ref s, ref c);
            Console.WriteLine(s + " " + c);
        }
        static void Proc(int x, ref int ss, ref int cc)
        {
            ss = x * x;
            cc = x * x * x;
        }
    }
}
A.0 0
B.25 25
C.125 125
D.25 125
E.None of the above
Answer: Option D

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

1.A function cannot be called from a subroutine.
2.The ref keyword causes arguments to be passed by reference.
3.While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control
passes back to the calling method.
4.A subroutine cannot be called from a function.
5.Functions and subroutines can be called recursively.
A.1, 2, 4
B.2, 3, 5
C.3, 5
D.4, 5
E.None of these
Answer: Option B

63.A function returns a value, whereas a subroutine cannot return a value.

A.True   
B.False
Answer: Option A