
\documentclass[twocolumn]{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.05in}
\setlength{\columnseprule}{0.3pt}
\usepackage{fancyvrb}
\usepackage{relsize}
\usepackage{hyperref}

\begin{document}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

Directions: {\bf Work only on this sheet} (on both sides, if needed); do
not turn in any supplementary sheets of paper. There is actually plenty
of room for your answers, as long as you organize yourself BEFORE
starting writing.

{\bf 1.} (20) Below is an excerpt from a conversation on the Web,
written by a developer of some commercial software product:

\begin{quote}

For a reasonably large project, the procedure symbols add over 1MB of
data to the final executable. Not only that, but one does not
necessarily want customers to see all the functions and files called...

\end{quote}

In the context of our course, how would one avoid this? 

{\bf 2.} In the ``toy'' example on p.13, suppose we devote 9 bits to the
mantissa and 7 bits to the exponent.

\begin{itemize}

\item [(a)] (20) What would be the representation of 1.25?  Answer in hex.

\item [(b)] (20) What is the largest positive number that can be stored?
Express your answer in the form $a \times 2^b$, with $a$ and $b$ in base
10, in simple form.  

\end{itemize} 

{\bf 3.} (40) Consider the code in the middle of p.19.  What would the
following print out?

\begin{Verbatim}[fontsize=\relsize{-2}]
printf("%x\n",Y);
printf("%d\n",Y % 8);
\end{Verbatim}

{\bf Solutions:}

{\bf 1.} The writer is referring to retaining the symbol table during
compilation.  In our context, this would be remedied by NOT using the
{\bf -g} option in GCC.

{\bf 2.a} The 5 would now be represented as 000000101 and the -2 as
1111110, so the full representation would be 0000001011111110 or 0x02fe.

{\bf 2.b} The mantissa would have to be as large as possible, which
would be 011111111, which is $2^8 - 1$.   Similarly, set the exponent to
0111111, which is $2^7 - 1$.  So, the largest possible storable number
would be $255 \times 2^{127}$.

{\bf 3.}

\begin{Verbatim}[fontsize=\relsize{-2}]
64636261
1
\end{Verbatim}

\end{document}

