Multiple choice technology programming languages

void main() { char ch='ABCD'; switch(ch) { case 'ABCD': printf("HelloABCD"); break; case 'A': printf("HelloA"); break; case 'B': printf("HelloB"); break; case 'C': printf("HelloC"); break; case 'D': printf("HelloD"); break; } }

  1. HelloA

  2. HelloB

  3. HelloABCD

  4. HelloD

  5. HelloC

  6. Compilation Error

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

Multi-character constants like 'ABCD' store multiple bytes in an int. The value is implementation-defined, but most compilers store characters in memory order, so 'ABCD' typically evaluates to the last character 'D' (or the integer representing the bytes). The switch matches case 'D', printing HelloD.