class SampleProgram { static void Main(string[] args) { string str = "Hello World!"; Console.WriteLine(String.Compare(str, "Hello World?").GetType()); } }
class SampleProgram
{
static void Main(string[] args)
string str = "Hello World!";
Console.WriteLine(String.Compare(str, "Hello World?").GetType());
}
a) 0 b) 1 c) String d) Hello World? e) System.Int32
System.Int32Because when compares two specified string objects, it returns an integer that indicates their relative position in the sort order.
e) System.Int32
Summary:Compares two specified System.String objects and returns an integer that indicatestheir relative position in the sort order.Parameters:strA:The first string to compare.strB:The second string to compare.Returns:A 32-bit signed integer that indicates the lexical relationship between the twocomparands.Value Condition Less than zero strA is less than strB. Zero strA equalsstrB. Greater than zero strA is greater than strB.
System.Int32
e--> system.Int32
e
system.int32
OUTPUT is e) System.Int32
0
1
e) -- String.Compare() should return an Int32.
e) System.Int32Explanation : return value of String.Compare() is integer . So GetType() returns System.Int32