Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ681
Page ↗
Q681DVDesignASIC interview problem

Shallow copying

TechniquesSystemVerilogObject-oriented dispatch
DifficultyEasy
TopicSV
LanguageSystemVerilog
Format4 choices
01

Problem

What value is printed?

Class declarationSystemVerilog
class Box; int v; endclass
class C; Box box; endclass
C a, b;
initial begin
  a = new;
  a.box = new;
  a.box.v = 1;
  b = new a;
  b.box.v = 9;
  $display("%0d", a.box.v);
end
02

Answer choices (4)