This question is old but made me curious. This is probably not at all safe. That is, you would need to know what you were feeding the file.
This is certainly fragile and, since it uses external writes, inherently insecure.
Caveat emptor...
If \jobname.tex is the .tex file, \jobname.dat should contain the questions. Each should be preceded by a line PRef:<label>. The label must not contain weird characters, including spaces. \princlude{} should contain a list of questions in the required order, separated by spaces. So if you want questions 98, 1 and 33 in that order, \princlude{98 1 33}. Other files are created on-the-fly either by direct writing or via bashful.
\documentclass{article}
\usepackage{bashful}
\begin{filecontents}{\jobname.dat}
PRef:1
$2+2=?$
PRef:2
If a chimpanzee has 5 bananas, 6 oranges and 2 coconuts, how many tomatoes does the nearest gorilla have?
Answers should be correct to 5 decimal places.
PRef:3
Is she right?
PRef:4
Why is there nothing rather than something?
PRef:5
Prove the Bishop wrong.
If the Bishop objects, consider the Queen's advice to Alice or take the train instead.
\end{filecontents}
\newwrite\writeme
\newcommand\princlude[1]{%
\immediate\openout\writeme=my.prefs%
\immediate\write\writeme{#1 }%
\immediate\closeout\writeme}
\AtEndDocument{%
\begin{enumerate}
\input{\jobname-pref.tex}
\end{enumerate}}
\begin{document}
\princlude{2 5 1}
\bash[stdoutFile=\jobname-pref.tex]
for i in $(cat my.prefs)
do
sed -n "/PRef:${i}/,/PRef:/p" prawf3.dat | sed -e "s/PRef:${i}/\\\\item /" -e '/^PRef:.*$/d'
done
\END
\end{document}

exsheetsdoes it. – Sep 11 '13 at 08:10exsheetsdoes not sort question but it allows to selectively include them from an external file. They're included in the order they're written in the external file, though. – cgnieder Sep 11 '13 at 08:48