Interviews - C# Corner

Sandeep Soni
What will be the output of the C#.NET code snippet given below?
  1. class SampleProgram
  2. {
  3. static void Main(string[] args)
  4. {
  5. string str = "Hello World!";
  6. Console.WriteLine(String.Compare(str, "Hello World?").GetType());
  7. }
  8. }

a) 0
b) 1
c) String
d) Hello World?
e) System.Int32

By Sandeep Soni in C# onNov 22 2018
  • Kailash Polai
    Dec, 2018 10

    e) System.Int32

    • 5
  • Jyoti Varshney
    Dec, 2018 6

    System.Int32Because when compares two specified string objects, it returns an integer that indicates their relative position in the sort order.

    • 5
  • sushil kumar
    Mar, 2019 6

    e) System.Int32

    • 4
  • Shivang Gupta
    Dec, 2018 5

    System.Int32

    • 4
  • Kiran Mahajan
    Dec, 2018 3

    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.

    • 4
  • Suresh K
    Dec, 2018 3

    System.Int32

    • 3
  • K Pathak
    Nov, 2018 29

    e) System.Int32

    • 3
  • Bhushan Bhasme
    Nov, 2018 29

    e--> system.Int32

    • 3
  • Siddhartha Sharma
    Apr, 2019 2

    e

    • 2
  • Dileep masam
    Mar, 2019 8

    system.int32

    • 2
  • Bala S
    Nov, 2018 26

    OUTPUT is e) System.Int32

    • 2
  • Nemilidinne Ashokreddy
    Mar, 2019 6

    System.Int32

    • 1
  • Deepak Vishwakarma
    Feb, 2019 22

    e) System.Int32

    • 1
  • Zaheen Farazi
    Jan, 2019 22

    0

    • 1
  • Salman Beg
    Jan, 2019 19

    System.Int32

    • 1
  • Amit Prakash
    Jan, 2019 2

    System.Int32

    • 1
  • Sangee Chellam
    Nov, 2018 29

    1

    • 1
  • Alan Moore
    Nov, 2018 24

    e) -- String.Compare() should return an Int32.

    • 1
  • NIlesh Sawant
    Sep, 2019 30

    System.Int32

    • 0
  • srinivas rao
    Sep, 2019 4

    e) System.Int32

    • 0
  • srinivas rao
    Sep, 2019 4

    e) System.Int32

    • 0
  • Rajesh Kakade
    Jun, 2019 4

    e

    • 0
  • purna kumar
    May, 2019 13

    System.Int32

    • 0
  • Ravi JV
    May, 2019 9

    e--> system.Int32

    • 0
  • Ravi JV
    Apr, 2019 29

    e) System.Int32Explanation : return value of String.Compare() is integer . So GetType() returns System.Int32

    • 0
  • Mahesh Alle
    Apr, 2019 22

    System.Int32

    • 0
  • Vikas shroti
    Apr, 2019 15

    1

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS