C# Programming - Constructors

Exercise : Constructors - General Questions
  • Constructors - General Questions
11.
Is it possible to invoke Garbage Collector explicitly?
Yes
No
Answer: Option
Explanation:
No answer description is available. Let's discuss.

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;
    }
}
i cannot be initialized in proc1().
proc1() can initialize i as well as j.
j can be initialized in proc2().
The constructor can never be declared as static.
proc2() can initialize i as well as j.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

13.
Which of the following statements is correct?
There is one garbage collector per program running in memory.
There is one common garbage collector for all programs.
An object is destroyed by the garbage collector when only one reference refers to it.
We have to specifically run the garbage collector after executing Visual Studio.NET.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

14.
Is it possible for you to prevent an object from being created by using zero argument constructor?
Yes
No
Answer: Option
Explanation:
No answer description is available. Let's discuss.

15.
Which of the following statements are correct about static functions?
Static functions are invoked using objects of a class.
Static functions can access static data as well as instance data.
Static functions are outside the class scope.
Static functions are invoked using class.
Answer: Option
Explanation:
No answer description is available. Let's discuss.