Friday 16 December 2011

87.Which of the following statements are true about the C#.NET code snippet given below?

String s1, s2;
s1 = "Hi";
s2 = "Hi";
1.String objects cannot be created without using new.
2.Only one object will get created.
3.s1 and s2 both will refer to the same object.
4.Two objects will get created, one pointed to by s1 and another pointed to bys2.
5.s1 and s2 are references to the same object.
A.1, 2, 4
B.2, 3, 5
C.3, 4
D.2, 5
Answer: Option B