\documentclass[11pt]{article}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\usepackage{url}
\title{CMSI 284 Encoding Exercise\\
or, the Joy of Hex}
\author{Submitted by: \underline{\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad}}
\date{}
\begin{document}
\maketitle
\section*{Instructions}
Do all of these problems \emph{without} the aid of a computer. The purpose of these exercises
is for you to develop ``manual'' encoding skills, which you will need in the event that a
zombie apocalypse wipes out all known systems technology on the planet.
You may submit this assignment in one of these ways. With \emph{both} options, make sure to
show your work where work needed to be done. This provides evidence that you did not use a
computer to determine the answers.
\begin{itemize}
\item If you know \LaTeX\ sufficiently, copy the \emph{source file} of this exercise and add your
solutions to this copy. Commit and push the file to your GitHub repository. \emph{Advantage:}
Drop-dead clear, sharp, unambiguous presentation. \emph{Disadvantage:} Intermediate computations
may be harder to write down.
\item Alternatively, you may \emph{print} the PDF version of this exercise and do your work on
paper. Submit this printout with your \emph{name} in the designated blank up top. \emph{Advantage:}
More convenient for showing your work. \emph{Disadvantage:} Handwritten answers may be harder to
read.
\end{itemize}
\section*{Mapping to Outcomes and Proficiencies}
The overall assignment covers outcomes \emph{1a}, \emph{1b}, \emph{4d}, and \emph{4f}. Each question will
pertain specifically to either \emph{1a} or \emph{1b} and will be given a score ranging from 0 to 4
based on the correctness of the answer. The average score for a given outcome, rounded,
determines the final proficiency for the assignment. e.g., If your numeric encoding answers
attain an average of 3.2, then \emph{1a} will get a proficiency of \texttt{|}.
Outcome \emph{4d} will be determined by how well you use the information given in class to compute
the requested answers, and how accurately you follow the instructions in this assignment.
Outcome \emph{4f} will be determined by whether you submit the assignment on time.
\pagebreak
\section{Integers}
\emph{Outcome 1a, 30 answers:} Assuming a 16-bit storage word, choose a value in the
requested encoding and specification, then provide its corresponding values for the other encodings:
\begin{enumerate}
\item Signed decimal \(< -31000\), not divisible by 2:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Hexadecimal:
\item Binary:
\end{enumerate}
\item Hexadecimal between \texttt{A234} and \texttt{DFFF} inclusive, no zeroes:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Binary:
\end{enumerate}
\item Hexadecimal between \texttt{0111} and \texttt{01FF} inclusive, two zeroes max:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Binary:
\end{enumerate}
\item Binary with high-order bits \texttt{1011} and at least 5 \texttt{1}s:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Hexadecimal:
\end{enumerate}
\item Hexadecimal between \texttt{8000} and \texttt{A000} \emph{exclusive}, one zero max:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Binary:
\end{enumerate}
\item Unsigned decimal between 48000 and 65000 inclusive, not divisible by 4:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Signed decimal:
\item Hexadecimal:
\item Binary:
\end{enumerate}
\item Unsigned decimal between 80 and 1024 \emph{exclusive}, not divisible by 4:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Signed decimal:
\item Hexadecimal:
\item Binary:
\end{enumerate}
\item Signed decimal between \(-69\) and \(-192\) inclusive, not divisible by 2:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Hexadecimal:
\item Binary:
\end{enumerate}
\item Binary with high-order bits \texttt{0001} and at least 7 \texttt{1}s:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Hexadecimal:
\end{enumerate}
\item Hexadecimal between \texttt{284C} and \texttt{789A} \emph{exclusive}, one zero max:
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Unsigned decimal:
\item Signed decimal:
\item Binary:
\end{enumerate}
\end{enumerate}
\section{Negation}
\emph{Outcome 1a, 5 answers:} Choose 16-bit signed words according to the given specifications,
then compute their negatives, expressing your answers in hex as well. You may have a maximum of
eight hex \texttt{0} digits among your chosen values:
\begin{enumerate}
\item \(x\) in \([\) \texttt{9876}\ldots\texttt{CDEF} \(] =\) \underline{\qquad\qquad\qquad\qquad};
\(-x = \) \underline{\qquad\qquad\qquad\qquad}
\item \(y\) in \([\) \texttt{D219}\ldots\texttt{EDEE} \(] =\) \underline{\qquad\qquad\qquad\qquad};
\(-y = \) \underline{\qquad\qquad\qquad\qquad}
\item \(z\) is odd, in \([\) \texttt{8087}\ldots\texttt{9191} \(] =\) \underline{\qquad\qquad\qquad\qquad};
\(-z = \) \underline{\qquad\qquad\qquad\qquad}
\item \(w\) is even, in \([\) \texttt{3BB0}\ldots\texttt{5FFE} \(] =\) \underline{\qquad\qquad\qquad\qquad};
\(-w = \) \underline{\qquad\qquad\qquad\qquad}
\item \(m\) in \([\) \texttt{010A}\ldots\texttt{020B} \(] =\) \underline{\qquad\qquad\qquad\qquad};
\(-m = \) \underline{\qquad\qquad\qquad\qquad}
\end{enumerate}
\section{Signed Arithmetic}
\emph{Outcome 1a, 28 answers:} Choose 16-bit addends with the given specifications and compute the
requested sums and states using \textbf{signed} arithmetic. You may have a maximum of twelve hex
\texttt{0} digits among your chosen values (not including the ones already given):
\begin{enumerate}
\item \texttt{2 8 \underline{\ } \underline{\ }} \quad + \quad \texttt{5 A \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{7 0 \underline{\ } \underline{\ }} \quad + \quad \texttt{E 7 \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{B B \underline{\ } \underline{\ }} \quad + \quad \texttt{8 A \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{A 1 \underline{\ } \underline{\ }} \quad + \quad \texttt{9 A \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{A 2 \underline{\ } \underline{\ }} \quad + \quad \texttt{2 A \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{5 8 \underline{\ } \underline{\ }} \quad + \quad \texttt{0 F \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\item \texttt{C 0 \underline{\ } \underline{\ }} \quad + \quad \texttt{C 0 \underline{\ } \underline{\ }}
\begin{enumerate}
\item Sum, saturated:
\item Sum, modular:
\item Carry (y/n):
\item Overflow (y/n):
\end{enumerate}
\end{enumerate}
\section{Units of Information}
\emph{Outcome 1a, 6 answers:} Many storage manufacturers sell the same product at different capacities
(e.g., Western Digital My Book; Drobo storage array; SanDisk SDXC Memory Card). Go window shopping and
find product listings for the smallest- and largest-capacity versions of such a product.
\begin{enumerate}
\item (not graded; mainly for reference) Provide the brand, model, min/max capacities, and prices of the
product line you've chosen:
\vspace{1.0in}
\item Interpret the device capacities as decimal units (i.e., megabytes, gigabytes, terabytes, etc.).
Show your calculations to answer the following:
\begin{enumerate}
\item How much does a kilobyte cost on the smallest-capacity version of the device?
\vspace{0.5in}
\item How much does a kilobyte cost on the largest-capacity version of the device?
\vspace{0.5in}
\item What is the price difference, on a per-kilobyte basis, between the smallest-
and largest-capacity versions of the device?
\vspace{0.5in}
\end{enumerate}
\item Interpret the device capacities as binary units (i.e., mebibytes, gibibytes, tebibytes, etc.).
Show your calculations to answer the following:
\begin{enumerate}
\item How much does a kibibyte cost on the smallest-capacity version of the device?
\vspace{0.5in}
\item How much does a kibibyte cost on the largest-capacity version of the device?
\vspace{0.5in}
\item What is the price difference, on a per-kibibyte basis, between the smallest-
and largest-capacity versions of the device?
\vspace{0.5in}
\end{enumerate}
\end{enumerate}
\section{IEEE 754 Encoding}
\emph{Outcome 1a, 8 answers:} Read each question carefully and provide the requested answers using the
proper encoding:
\begin{enumerate}
\item Choose a number between 0 and 1 that has at least 4 non-zero digits in the decimal and is
\emph{not} a power of 2 (e.g., \(0.0625\) is \(2^{-4}\) and thus would not count):
\vspace{0.125in}
Your chosen number in decimal form: \underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Single-precision (32-bit) approximation:
\vspace{0.125in}
\item Double-precision (64-bit) approximation:
\vspace{0.125in}
\end{enumerate}
\item Determine the smallest positive whole number that cannot be represented in memory with the
given floating point encoding, and state why:
\begin{enumerate}
\item \ldots in single-precision (32-bit):
\vspace{1.0in}
\item \ldots in double-precision (64-bit):
\vspace{1.0in}
\end{enumerate}
\item Choose an 8-digit hexadecimal number where \emph{no} digit is repeated nor sequential
(e.g., \texttt{134F EA85} is not allowed because of \texttt{F} followed by \texttt{E}):
\vspace{0.125in}
\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Provide the IEEE 754 floating-point value that these bits represent in base 2 (use scientific notation):
\vspace{1.0in}
\item Provide its closest approximate value in base 10 (use scientific notation if necessary):
\vspace{1.0in}
\end{enumerate}
\item Choose 16-digit hexadecimal number where no more than 2 adjacent digits are the same
(e.g., \texttt{0102 EFF3 E157 C411} is not allowed because of \texttt{FF} and \texttt{11}):
\vspace{0.125in}
\underline{\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item Provide the IEEE 754 floating-point value that these bits represent in base 2 (use scientific notation):
\vspace{1.0in}
\item Provide its closest approximate value in base 10 (use scientific notation if necessary):
\vspace{1.0in}
\end{enumerate}
\end{enumerate}
\section{Character Encoding}
\emph{Outcome 1b, 44 answers:} Read each question carefully and provide the requested answers using the
proper encoding. \emph{Remember to show your work to prove that you encoded these manually:}
\begin{enumerate}
\item The city of Los Angeles is unhappy with the Unicode SNOWMAN character,
as they are unable to use it on their official documents to represent a fun day in the snow.
They requested a new ``sandman'' symbol in its place.
Pick a codepoint for this new character, and show how it would be encoded in UTF-8, UTF-16, and UTF-32.
The codepoint must be have 6 unique digits and start with a \texttt{10} (i.e., it belongs under
Supplemental Private Use Area-B).
\texttt{10}\underline{\qquad\qquad\qquad\qquad\qquad\qquad}
\begin{enumerate}
\item UTF-8:
\item UTF-16:
\item UTF-32:
\end{enumerate}
\item Encode the first eight letters of your first and last name combined (including the space
in between) as requested, \emph{replacing four of them} with corresponding characters from the
Enclosed Alphanumerics Unicode block (uppercase or lowercase, your choice):
\begin{enumerate}
\item UTF-8:
\vspace{1.0in}
\item UTF-16:
\vspace{1.0in}
\item UTF-32:
\vspace{1.0in}
\end{enumerate}
(since we're dealing with Unicode anyway, if your name, when properly written, has an accent or
other diacritical, then use that too)
\item Choose four emoji without variants (the monster master list can be found in
\url{http://unicode.org/emoji/charts/full-emoji-list.html}) to describe your dream vacation.
Encode them:
\begin{enumerate}
\item UTF-8:
\vspace{1.0in}
\item UTF-16:
\vspace{1.0in}
\item UTF-32:
\vspace{1.0in}
\end{enumerate}
\emph{Fun tip:} Remember that there are \emph{flag} emoji to represent specific locations.
\item This one is given 5 times the weight: explain why \url{https://xkcd.com/380/} is funny.
(yes, it's funny)
Remember, XKCD comics include a mouseover caption that is an integral part of the strip.
\vspace{1.0in}
\end{enumerate}
\end{document}