While it would be possible to give a superficial answer to your question (e.g., tonic and dominant chords are the chords built on the first and fifth degrees of the scale; in C major, which is CDEFGABC, they are C and G) as well as unsystematic and therefore near-useless information (these chords are primarily used in cadences, with V followed by I constituting a full cadence which completely closes a unit, and a stop on V constituting a half cadence which leaves a unit open for continuation), you need to invest some time (and maybe money) in a good book and/or teacher for the concepts to be of any use.
I think when you were asked "How can you compose without knowing that?", this wasn't referring to a specific piece of information, but to the fact that an unfamiliarity with these concepts implies a complete unfamiliarity with the system of tonality, and theory of composition, which rests on them.