\documentclass{article}

\usepackage{amsmath}
\usepackage{listings}
\usepackage{framed}
\usepackage{amssymb}
\usepackage{graphicx}

\addtolength{\textwidth}{1in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\textheight}{1in}
\addtolength{\topmargin}{-0.5in}

\begin{document}

\noindent
\centerline{\Large\bf 22C:16 Quiz 4}
\bigskip
\centerline{\Large\bf Date: Feb 14th, 2012}


\medskip
\hrule

\medskip

\begin{enumerate}
\item Write down the value and type of each of these expressions.
Assume that \texttt{x} is a variable of type \texttt{int} and has value 25.
Also assume that the \texttt{math} module has been imported before these expressions 
are executed.
\begin{itemize}
\item[(a)] \texttt{math.ceil(2.25)/math.floor(1.5)+200L*5}

1003.0

\vspace{0.5in}

\item[(b)] \texttt{(-1**2)**2\%3-1}

0

\vspace{0.5in}

\item[(c)] \texttt{30 > x or 100/0 != "hello"}

True

\vspace{0.5in}

\item[(d)] \texttt{float(len("expression"))/(5 + 15/len(str(100+15)))}

1.0

\vspace{0.5in}

\item[(e)] \texttt{2-len(str(math.trunc(678.54)))**2}

-7

\end{itemize}

\vspace{1.5in}



\noindent
\textbf{Please turn the page over for the second problem.}

\newpage

\item 
Write down the output produced by the following program.
\begin{framed}
\begin{verbatim}
x = 10
while x < 20:
        y = x + 4
        while y > x:
                if ((x + y) % 5 == 0):
                        print x + y
                y = y - 2

        x = x + 1
\end{verbatim}
\end{framed}

\bigskip

\begin{verbatim}
30
30
40
40
\end{verbatim}
\end{enumerate}
\end{document}
