Multiple choice

Consider the following C statements. int i,alpha = 65; char ch[27]; for(i = 0;i<2;i++) { ch[i] = alpha; alpha = alpha + 1; } printf(!!!^!!!%s!!!^!!!,ch); What would be the output of the above C code?

  1. AB

  2. ABC

  3. 6566

  4. Compiler error

  5. 01

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This is the correct option as the variable alpha is initialized with the value 65, which is an ASCII equivalent of 'A'. Since, 'for' loop lasts for the values 0 and 1, therefore the values 65 and 66 are initialized to the char array 'ch' that is nothing but ASCII value of 'A' and 'B'.