It depends on how the virus was developed, but as an example, in assembly, this:
UnusedString DB 'Concept Virus(CV) V.5, Copyright(C)2001 R.P.China.', 0
will embed the string (null terminated) into the object code and executable file. Whether or not the code actually references UnusedString is meaningless to most assemblers (in my experience).
Visual C++ will remove "unused local variables" as part of its dead code optimizations. However, if you assign a value to a variable, but don't otherwise use it, Visual C++ does not consider it "unused", and will leave it in the application. So...
char UnusedString[] = "Concept Virus(CV) V.5, Copyright(C)2001 R.P.China.";
will also result in the same null-terminated string in the application, that is not actually used.
Then there's the header of .exe or .dll files, that can contain a multitude of things. For an example, check out the properties dialog of a Microsoft supplied executable.