Constructors

Q1:
Which of the following statements are correct about the C#.NET code snippet given below?
class Sample
{
    static int i;
    int j;
    public void proc1()
    {
        i = 11; 
        j = 22;
    }
    public static void proc2()
    {
        i = 1;
        j = 2;
    }
    static Sample()
    {
        i = 0; 
        j = 0;
    }
}

A
i cannot be initialized in proc1().

B
proc1() can initialize i as well as j.

C
j can be initialized in proc2().

D
The constructor can never be declared as static.

E
proc2() can initialize i as well as j.

ANS:B -

proc1() can initialize i as well as j.

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.