Shortcut Navigation:

Static Functions XA0 Quiz

Which of the following statements is correct?

Which of the following statements is correct about the C#.NET code snippet given below? SampleProgram namespace IndiabixConsoleApplication{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 ways to create an object of the Sample class given below will work correctly? Sample 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 are correct about static functions?  
  1. Static functions can access only static data.
  2. Static functions cannot call instance functions.
  3. It is necessary to initialize static data.
  4. Instance functions can call static functions and access static data.
  5. this reference is passed to static functions. 

Which of the following statements is correct about constructors?

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);

In which of the following should the methods of a class differ if they are to be treated as overloaded methods?  
  1. Type of arguments
  2. Return type of methods
  3. Number of arguments
  4. Names of methods
  5. Order of arguments 

Can static procedures access instance data?

Which of the following statements are correct about constructors in C#.NET?  
  1. Constructors cannot be overloaded.
  2. Constructors always have the name same as the name of the class.
  3. Constructors are never called explicitly.
  4. Constructors never return any value.
  5. Constructors allocate space for the object in memory. 

How many times can a constructor be called during lifetime of the object?