Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Select output for the following set of code?

  1. class sample
  2. {
  3. public int i;
  4. public int[] arr = new int[];
  5. public void fun(int i, int val)
  6. {
  7. arr[i] = val;
  8. }
  9. }
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. sample s = new sample();
  15. s.i = ;
  16. sample.fun(1, 5);
  17. s.fun(1, 5);
  18. Console.ReadLine();
  19. }
  20. }

user-image
Question added by Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
Date Posted: 2016/10/21
raman panwar
by raman panwar , Software Developer , Wipro Technology

Compile time errors will come.

line 4 - size of an array is not mentioned

line 15 - no value 

line 16 - fun method is not static , so cannot use class name for calling fun method

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.