🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Storage Classes in C: all 15 questions

Quiz: Storage Classes in C · Question 9 of 15

Where do static and global variables live in memory?

Where do static and global variables live in memory?

  1. A.On the stack
  2. B.On the heap
  3. C.In the data segment (or BSS if not initialised)
  4. D.In CPU registers
Answer & explanation

Correct answer: In the data segment (or BSS if not initialised)

They exist for the whole run, so they are not on the stack; initialised ones go in data, zero-initialised ones in BSS.

Can you get the rest right without peeking?

Take the timed Quiz: Storage Classes in C quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →