Multiple choice

The library function exit ( ) causes an exit from _____.

  1. the loop in which it occurs

  2. the block in which it occurs

  3. the function in which it occurs

  4. the program in which it occurs

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

The exit() function in C++ terminates the entire program immediately, not just the current function or loop. It performs cleanup and ends program execution. Option D correctly states it causes exit from 'the program in which it occurs'. This is different from return, which only exits from the current function. The exit() function is defined in header and affects the whole program.