Multiple choice general knowledge

Guess the Output void main() { printf("Hello"); return 5; printf(" World"); }

  1. Hello World

  2. Compilation Error - Cannot return when return type is Void

  3. Hello

  4. Segmentation fault

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

In C, a return statement causes the function to exit immediately, even if the return type is void. The 'return 5;' is valid - the 5 is simply discarded. The printf(" World") after return is never reached because execution terminates at return. Output is 'Hello'.