1.

Select the appropriate set of code for conversion of string to hexa form.
static void Main(string[] args) { string teststring = "MIKA@?&"; string hex = ConvertstringToHex(teststring, system.Text.Encoding.Unicode); Console.WriteLine(hex); } a) static string ConvertstringToHex(string input, system.Text.Encoding encoding) { string Bytes = encoding.GetBytes(input); string Builder sbBytes = new Builder sbBytes(); for each (byte 'b' in StringBytes) { sBytes.AppendFormat("{0:x2}", b); } return sbBytes.Tostring(); } b) static string ConvertstringToHex(string input, system.Text.Encoding encoding) { char[]string Bytes = encoding.GetBytes(input); string Builder sbBytes = new Builder sbBytes(StringBytes.Length*2); for each (byte 'b' in StringBytes) { sBytes.AppendFormat("{0:X2}", b); } return sbBytes.Tostring(); } c) public static string ConvertStringToHex(String input, System.Text.Encoding encoding) { { Byte[] stringBytes = encoding.GetBytes(input); StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2); foreach (byte b in stringBytes) { sbBytes.AppendFormat("{0:X2}", b); } Console.WriteLine(sbBytes.ToString());//sbBytes.ToString()); return sbBytes.ToString(); } } 

A. A
B. B
C. C
D. None of the mentioned
Answer» D. None of the mentioned


Discussion

No Comment Found