C# Programming :: Constructors
-
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; } }
-
Which of the following statements is correct?
-
Is it possible for you to prevent an object from being created by using zero argument constructor?
-
Which of the following statements are correct about static functions?
-
What will be the output of the C#.NET code snippet given below?
namespace FreshergateConsoleApplication { class Sample { static Sample() { Console.Write("Sampleclasn"); } public static void GATE1() { Console.Write("GATE1 method "); } } class MyProgram { static void Main(string[ ] args) { Sample.GATE1(); } } }
-
Which of the following statements is correct about constructors in C#.NET?
-
What will be the output of the C#.NET code snippet given below?
namespace FreshergateConsoleApplication { class Sample { public static void fun1() { Console.WriteLine("Gate1 method"); } public void fun2() { fun1(); Console.WriteLine("Gate2 method"); } public void fun2(int i) { Console.WriteLine(i); fun2(); } } class MyProgram { static void Main(string[ ] args) { Sample s = new Sample(); Sample.fun1(); s.fun2(123); } } }
A.
There is one garbage collector per program running in memory.
|
B.
There is one common garbage collector for all programs.
|
C.
An object is destroyed by the garbage collector when only one reference refers to it.
|
D.
We have to specifically run the garbage collector after executing Visual Studio.NET.
|