What Will Be The Output Of The Following Code: using System; using System.Collections.Generic; namespace TechBeamers { public delegate void sampleDelegate(int num); public class testDelegate { public void checkEven(int num) { if(num%2 ==0) Console.WriteLine("This number is an even number"); else Console.WriteLine("This number is an odd number"); } public void squareNumber(int num) { Console.WriteLine("Square of this number is: {0}", num*num); } } class sample { public static void Main( ) { testDelegate obj = new testDelegate(); sampleDelegate delegateObj = new sampleDelegate(obj.checkEven); delegateObj += new sampleDelegate(obj.squareNumber); delegateObj(25); } } }
What Will Be The Output Of The Following Code: using System; using System.Collections.ObjectModel; using System.Collections.Generic; public class Program { public static void Main() { var arr = new List { 20, 40, 35, 85, 70 }; var collection = new Collection(arr); arr.Add(60); arr.Sort(); Console.WriteLine(String.Join(",", collection)); } }
What Will Be The Output Of The Following Code: using System; public class Program { public static void Main() { Nullable number = 0; int num = 1; Console.WriteLine(number.GetType() == num.GetType()); } }
What Will Be The Output Of The Following Code: using System; using System.Collections.ObjectModel; using System.Collections.Generic; namespace TechBeamers { delegate void A(ref string str); public class sample { public static void StringMarker(ref string a) { a = a.Substring(0, a.Length - 6); } } public class Program { public static void Main(string[] args) { A str1; string str = "Let's Learn CSharp"; str1 = sample.StringMarker; str1(ref str); Console.WriteLine(str); } } }
What Will Be The Output Of The Following Code: using System; public class Program { public static void Main(string[] args) { bool a = true; bool b = false; a ^= b; Console.WriteLine(a); Console.ReadLine(); } }