Sail E0 Webinar
Question
what will be the output of code snippet?class UnsafeCode {     unsafe static void Main()     {         char[] arr = { 'A', 'B', 'C', 'D', 'E' };         fixed (char* P = arr)         {             int i;             for (i = 0 ;i < 5 ;i++)             if (*P % 2 == 0)             ++*P;             else             (*P)++;             Console.WriteLine(arr);         }         Console.ReadLine();     } }
Options:
A .  ACCEE
B .  FBCDE
C .  BBDDF
D .  BBCEE
Answer: Option B


Output:FBCDE



Was this answer helpful ?

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers