In this program, printf("GATE-CSE"); statement is not part of any case. Compiler transfer control with Switch(0) to case 0 if found in switch block, otherwise check for default case in swich block.
Hence, printf("GATE-CSE"); statemt will not be executed by compiler. Therefore, compiler execute case 1 and print One. As there is not break statement after that compiler continue execute all statements till break statement or end of switch block. OUTPUT: One None
As there is no case 5 in switch block, so compiler execure default case So, it will print None As there is not break statement after that compiler continue execute all statements till break statement or end of switch block. OUTPUT: None One Two
*("practicepaper"+5) return the index-5 char (with 'p' as index-0), which is char 'i'. Compiler directly transfer control to case 'i'. NOTE: default is written above case'i', but compiler executes default case only when no case matches with switch.
Statement switch(a=0) evaluated by compiler as switch(0) (NOTE: a=0 transfer 0 into a and return 0) Hence, case 0 match in switch block. It will print Zero, As there is not break statement after that compiler continue execute all statements till break statement or end of switch block.
Statement switch(a=5) evaluated by compiler as switch(5) (NOTE: a=5 transfer 5 into a and return 5) Now, there is not a case 5 in switch block. NOTE: default is written at top in swich block but it will execute only when no case match in switch block. As there is no case 5 in switch block, so compiler execure default case So, it will print GATE-CSE As there is not break statement after that compiler continue execute all statements till break statement or end of switch block. OUTPUT: GATE-CSE Zero One