1.

Which of the following code is used for conversion of hex to string form ?
static void Main(string[] args) { string testString = "MIKA@?&^"; string normal = ConvertHexToString (hex, System.Text.Encoding.Unicode); Console.WriteLine(normal); Console.ReadLine(); } a) public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { char[] numberChars = hexInput.Length; byte[] bytes = new byte[numberChars / 2]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 0), 16); } return encoding.GetString(bytes); } b) public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { int numberChars = hexInput.Length; byte[] bytes = new byte[numberChars / 2]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16); } return encoding.GetString(bytes); } c) public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding) { string numberChars = hexInput.Length; byte[] bytes = new byte[numberChars]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16); } return encoding.GetString(bytes); } 

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


Discussion

No Comment Found