Multiple choice

What will be the output of the above code?

String str1 = Lets learn programming in C#;
String str2;
str2 = str1.Substring(5,10);
Console.WriteLine(str2);

  1. Error

  2. learn pro

  3. earn progr

  4. earn prog

  5. learn prog

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

learn prog is the correct answer because the extraction will begin from the 5th character, which is 'l' and will extract 10 characters from there. The 10th character from 'l' is 'g'.