← Synopsys questions

Static variables in memory

Filed under Synopsys

Free read 2 of 3

The Data segment stores initialized global and static variables. The BSS (Block Started by Symbol) segment stores uninitialized global and static variables.

The question

Explain the memory layout of static variables in C/C++ and the difference between the Data segment and BSS segment.

Constraints

  • Focus on compiled languages like C/C++.
  • Explain initialization behavior.

Approach

  1. The Data segment stores initialized global and static variables. The BSS (Block Started by Symbol) segment stores uninitialized global and static variables.

Tips

  • What they are testing: Be prepared to discuss how static variables differ from global variables in terms of scope.
  • Common mistake: Confusing the stack/heap with static memory segments.

Related Synopsys questions

Collected from public candidate posts and coding forums. Updated Nov 2026.