Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Constructors Questions
What will be the output of the C#.NET code snippet given below? namespace CuriousTabConsoleApplication { class Sample { public static void fun1() { Console.WriteLine("CuriousTab1 method"); } public void fun2() { fun1(); Console.WriteLine("CuriousTab2 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); } } }
What will be the output of the C#.NET code snippet given below? namespace CuriousTabConsoleApplication { class Sample { static Sample() { Console.Write("Sample class "); } public static void CuriousTab1() { Console.Write("CuriousTab1 method "); } } class MyProgram { static void Main(string[ ] args) { Sample.CuriousTab1(); } } }
Is it possible for you to prevent an object from being created by using zero argument constructor?
Which of the following is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below? Sample s1 = new Sample(); Sample s2 = new Sample(9, 5.6f);
Which of the following ways to create an object of the Sample class given below will work correctly? class Sample { int i; Single j; double k; public Sample (int ii, Single jj, double kk) { i = ii; j = jj; k = kk; } }
Which of the following statements is correct about constructors?
Is it possible to invoke Garbage Collector explicitly?
In which of the following should the methods of a class differ if they are to be treated as overloaded methods? Type of arguments Return type of methods Number of arguments Names of methods Order of arguments
Which of the following statements are correct about static functions?
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?
Which of the following statements is correct about the C#.NET code snippet given below? namespace CuriousTabConsoleApplication { class Sample { public int func() { return 1; } public Single func() { return 2.4f ; } } class Program { static void Main(string[ ] args) { Sample s1 = new Sample(); int i; i = s1.func(); Single j; j = s1.func(); } } }
Which of the following statements is correct about constructors in C#.NET?
Can static procedures access instance data?
How many times can a constructor be called during lifetime of the object?
Which of the following statements are correct about constructors in C#.NET? Constructors cannot be overloaded. Constructors always have the name same as the name of the class. Constructors are never called explicitly. Constructors never return any value. Constructors allocate space for the object in memory.
Which of the following statements is correct?
Which of the following statements are correct about static functions? Static functions can access only static data. Static functions cannot call instance functions. It is necessary to initialize static data. Instance functions can call static functions and access static data. this reference is passed to static functions.