Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Dynamic-array resizing

Q049·Free·SystemVerilog

Dynamic-array resizing

Difficulty
Easy
Topic
Data Structures
Language
SV
Interview prompt

Question

What does the display print?

Provided context

Code to inspect

int da[];
initial begin
  da = new[3];
  da = '{1, 2, 3};
  da = new[5](da);
  $display("%0d %0d %0d", da.size(), da[2], da[4]);
end
Choose one

Answer choices

  1. A. 5 3 0
  2. B. 5 0 0
  3. C. 3 3 0
  4. D. 5 3 x
Exact question handoffPractice Q049

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Containers and Aggregates

Review queues, dynamic and associative arrays, structures, unions, and storage ownership.

  • Data Structures
  • SystemVerilog
  • Container operations
Containers and Aggregates →
Continue practicing

Related questions

Q195 · Data StructuresAssociative-array traversalEasy→Q219 · Data StructuresQueue methodsEasyP→Q071 · Data StructuresDynamic arrays and queuesEasy→
ASIC.FYI · Learn silicon end to end.info@asic.fyi