What will be the result of the following code execution?
 
using System; 

class App 
{ 
     static void Main() 
     { 
        string s; 
        s+="string"; 
        Console.WriteLine(s); 
    } 
 }
 
Explanation
Variable s is not initialized. If code looked like this
 
string s = "";
s += "string"; 
Cnsole.WriteLine(s);
 
then everything would be fine, because at least some value is assigned to variable s.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes