X

Which of the following statements is correct about the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class Sample { public int index; public int[] arr = new int[10]; public void fun(int i, int val) { arr[i] = val; } } class MyProgram { static void Main(string[] args) { Sample s = new Sample(); s.index = 20; Sample.fun(1, 5); s.fun(1, 5); } } }

( 5 )  .  1 Rating  .  6 Attempts
19 views   .  0 comments  .   . 

Download Solution PDF
  1.  s.index = 20 will report an error since index is public.

  2.  The call s.fun(1, 5) will work correctly.

  3.  Sample.fun(1, 5) will set a value 5 in arr[ 1 ].

  4.  The call Sample.fun(1, 5) cannot work since fun() is not a shared function.

Give Rating
Report

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

Write Your Comments or Explanations to Help Others
Comments(0)



No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Explore Other Libraries

X




Copyright (c) 2021 TuteeHUB

OPEN APP
Channel Join Group Join