This can be done in several ways. Here's one possibility using theorem-like structures defined with the help of the amsthm
package:
\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{lipsum}
\theoremstyle{definition}
\newtheorem{que}{Question}
\newtheorem{ans}[que]{Answer to question}
\BeforeBeginEnvironment{ans}{\addtocounter{que}{-1}}
\title{Assignment}
\author{The Author}
\date{\today}
\begin{document}
\maketitle
\begin{que}
\lipsum[4]
\end{que}
\begin{ans}
\lipsum[4]
\end{ans}
\begin{que}
\lipsum[4]
\end{que}
\begin{ans}
\lipsum[4]
\end{ans}
\end{document}

In the previous solution I made the assumption that each question was immediately followed by its answer; a solution with more freedom might be:
\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{refcount}
\usepackage{lipsum}
\theoremstyle{definition}
\newtheorem{que}{Question}
\newtheorem{answ}{Answer to question}
\newenvironment{ans}[1]
{\setcounterref{answ}{#1}\addtocounter{answ}{-1}\begin{answ}}
{\end{answ}}
\title{Assignment}
\author{The Author}
\date{\today}
\begin{document}
\maketitle
\begin{que}
\label{que:foo}
\lipsum[4]
\end{que}
\begin{que}
\label{que:bar}
\lipsum[4]
\end{que}
\begin{ans}{que:bar}
\lipsum[4]
\end{ans}
\begin{ans}{que:foo}
\lipsum[4]
\end{ans}
\end{document}

In this approach, you label each question (using the standard \label
command), and then use the string used for the label as a mandatory argument for the ans
environment.
exam
document class that comes with MiKTeX (via CTAN) – Sean Allred Sep 4 '13 at 3:57