• Constructors - General Questions
11. 

Is it possible to invoke Garbage Collector explicitly?

A. Yes
B. No

12. 

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.

13. 

Is it possible for you to prevent an object from being created by using zero argument constructor?

A. Yes
B. No

14. 

Which of the following statements are correct about static functions?

A. Static functions are invoked using objects of a class.
B. Static functions can access static data as well as instance data.
C. Static functions are outside the class scope.
D. Static functions are invoked using class.

15. 

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

namespace IndiabixConsoleApplication
{ 
    class Sample
    { 
        static Sample()
        { 
            Console.Write("Sample class ");
        }
        public static void Bix1()
        { 
            Console.Write("Bix1 method ");
        } 
    } 
    class MyProgram
    { 
        static void Main(string[ ] args)
        { 
            Sample.Bix1();
        } 
    } 
}

A. Sample class Bix1 method
B. Bix1 method
C. Sample class
D. Bix1 method Sample class
E. Sample class Sample class