The most cost-effective solution, including the cost of your time spent in (a) infrastructure development and (b) writing questions is to use an existing web-based homework system. One such that comes with an extensive problem library — and that's free if you run it on your own server — is WeBWork: http://webwork.maa.org.
There are several good commercial systems, which are often available bundled with particular textbooks and have libraries of problems already organized by the textbook's chapters and sections. One such I know well and highly recommend is WebAssign: http://webassign.net
Such systems are particularly helpful for high-enrollment sections, owing to the reporting features, etc.