Interviews15 answers
What will be the output of this code?
15 Answers
20
10
SubashPosted Jul 12, 2016, 11:40 PM EDT
20
10
Ram NunnaPosted Aug 5, 2015, 5:37 AM EDT
20
10
Rahul PrajapatPosted Jun 1, 2015, 6:08 PM EDT
20
10
Pankaj Kumar ChoudharyPosted Jun 1, 2015, 8:53 AM EDT
20
10
coz struct is value type so it will assign different memory for both object.but if you will change struct with class then result will be
20
20
coz class is reference type and it will not assign different memory for different objects of a class.
Manish KaushalPosted May 23, 2015, 12:22 AM EDT
10
Ramendra kumar vermaPosted Jan 23, 2015, 1:15 AM EST
Wht r the correct answer priti ???
i think 10 is right ans because in a main method do not create object of fun method
Rahul RaiPosted Nov 12, 2014, 11:35 PM EST
10
Rahul RaiPosted Nov 12, 2014, 11:35 PM EST
what is the correct answer ??
Najna AbdullaPosted Sep 3, 2014, 2:19 AM EDT
20
10
Murari ShrivastavaPosted Apr 23, 2014, 8:55 PM EDT
10 Only
Tirthak ShahPosted Jan 1, 2014, 2:14 AM EST
20 Next line 10
Mahesh AllePosted Dec 16, 2013, 1:09 AM EST
just 10
Pramod LawatePosted Dec 13, 2013, 7:58 AM EST
20
10
Prabakaran RajaPosted Dec 13, 2013, 3:03 AM EST
struct sample
{
public int a;
}
class Program
{
static void Main(string[] args)
{
sample s = new sample();
s.a = 10;
Fun(s);
Console.WriteLine(s.a);
Console.ReadLine();
}
static void Fun(sample ss)
{
ss.a = 20;
Console.WriteLine(ss.a);
}
}
Priti KumariPosted Dec 9, 2013, 2:14 AM EST









