- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
For the code snippet shown below, which of the following statements are valid?

public class TestIndiaBix
{
    public void TestSub<M> (M arg)
    {
        Console.Write(arg);
    }
}
class MyProgram
{
    static void Main(string[] args)
    {
        TestIndiaBix bix = new TestIndiaBix();
        bix.TestSub("IndiaBIX ");
        bix.TestSub(4.2f);
    }
}

1.Program will compile and on execution will print: IndiaBIX 4.2

2.A non generic class Hello cannot have generic subroutine.

3.Compiler will generate an error.

4.Program will generate a run-time exception.

Posted Date:-2021-02-25 10:20:32


More MCQS Questions and answers

Search