🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Functions and Recursion: all 10 questions

Quiz: C Functions and Recursion · Question 10 of 10

How long does an ordinary (auto) local variable exist?

How long does an ordinary (auto) local variable exist?

  1. A.Until the program ends
  2. B.Only while its function or block is running
  3. C.Until it is printed
  4. D.For as long as the file is open
Answer & explanation

Correct answer: Only while its function or block is running

Local variables live on the stack and disappear when the function returns; static locals are the exception.

Can you get the rest right without peeking?

Take the timed Quiz: C Functions and Recursion quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →