Not in any country, including the USA, that follows the Bern Convention; it is copyrighted from the moment the creative work of original authorship is fixed in a tangible form (e.g., written down or otherwise recorded).
Under US copyright law, unpublished works have copyright for 70 years after the death of the author. Published works have duration determined by when it was published, if before 1978, as well as whether the publication conformed to the requirements in force at the time (i.e., notice or registration, 28-year renewal filing).
A work is protected by copyright as soon as it is fixed in a tangible medium, i.e. even before it was published.
Publication is not necessary for a work to be protected by copyrighted. Unpublished works can be submitted for copyright registration and published at a later date.
Once your work is fixed (written down, recorded, etc.), it is automatically protected by copyright.
Let people know that you believe your music is protected by copyright: You should always write the international copyright symbol ©, the name of the copyright owner (i.e. you the composer or any publisher to whom the copyright may have been assigned) and the year in which the work was first published (or written if not yet published) in a prominent position on the original and every copy of the work. This will put users on notice of the fact that the work may be protected by copyright
Under US Copyright Law, copyright attaches as soon as a work is created, whether published or not. Published or unpublished works do not need to be "signed" to fall under copyright protection because the creation of a work already establishes copyright ownership.
A book can be protected by copyright if it is never published, and a book can be published without being protected by copyright. Copyright protection applies automatically when a work of sufficient originality is fixed in a tangible medium. Centuries ago, this usually meant it was protected when it was published, but today "fixed in a tangible medium" can mean typed into a computer, handwritten on paper, or even spray-painted onto a wall. A work in the public domain, whether copyright expired or it was never copyrightable, can still be published. In these cases, new material such as annotations, translations, or illustrations might be protected (as in highly-researched Shakespeare or an illustrated fairy tale), and in some countries, the layout and printing can be protected. But the text itself is still in the public domain.
Under US law, yes. A work is protected by copyright as soon as it is created, and it would be a violation of copyright to copy IN ANY WAY even an unpublished draft work without the consent of the copyright holder.
If you are using materials that are not your original work, you need permission from the copyright holder. Works that are entirely your own are automatically protected by copyright as soon as they are fixed in a tangible medium.
The most important factor in establishing if copyright protection exists it the date of creation/publication. In most cases anything published before 1923 is in the public domain. After that date you will need to do a bit of research to determine if a work is protected or not.
Once a work of sufficient originality is fixed in a tangible medium, it is automatically protected by copyright.
The code is protected as a literary work.
Written works are protected by copyright as soon as they are "fixed" in a tangible format, which is to say written down. Publishing is no longer required for protection.