The information carried in its DNA instructed the embryo to develop into a snake. You can read more about snakes at the Animal Planet link provided below.
King Cobras and Kingsnakes and any other snakes with 'King' in the name will eat other snakes. There are others apart from those mentioned that are ophiophagus (meaning that they eat snakes) such as...