% 
% hw1.tex
%
%   This is a LaTeX template to get you started
%   making problem-set solutions
%
 
\documentclass[11pt]{article}
\usepackage{amsmath}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{-0.5in}

% *** GRAPHICS RELATED PACKAGES ***
%

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

 \graphicspath{{./}}
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\bf Data, Logic, and Computing\\[2ex] 
       \rm\normalsize ECS 17 (Winter 2026)}
\date{\today}
\author{Patrice Koehl\\koehl@cs.ucdavis.edu}

\begin{document}
\maketitle
\section*{\underline{Homework 2 }}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 1} 

\begin{itemize}
\item What is the binary representation of the hexadecimal 7C?
\item What is the hexadecimal representation of the binary number 1110101?
\item How many bits are there in 22 bytes?
\item What is the largest  unsigned integer that can be stored on one byte?
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 2} 

\begin{itemize}
\item Let $A$ be the binary number 1110110 and $B$ the binary number 11100010; find the binary number $C$ that satisfies $A+C = B$.
\item Let $A$ be the hexadecimal number \#3FF and $B$ the hexadecimal number \#F4F; find the hexadecimal number $C$ that satisfies $A+C = B$.
\item Let $A$ be the hexadecimal number \#3EF and $B$ the binary number 10000000000; find the hexadecimal number $C$ that satisfies $A+C = B$.
\item Let $A$ be the binary number 1000000000 and $B$ the hexadecimal number \#227; find the binary number $C$ that satisfies $A+C = B$.
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 3}

We are on the island of knights and knaves . You meet three residents, Alex, Bill, and Claudia who make the following statements:
\begin{align*}
&\text{Alex says: ``Bill is a knave and Claudia is a knight"}\\
&\text{Bill says: ``Claudia is a knight and Alex is a knight"}\\
&\text{Claudia says: ``I like cookies"}
\end{align*}
Does Claudia really like cookies?


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 4}

A very special island is inhabited only by knights and knaves. Knights always tell the truth, and knaves always lie. You meet three inhabitants: Alex, John and Sally. Alex says, ``At least one of the following is true: that Sally is a knave or that I am a knight." John says, "Alex could claim that I am a knave." Sally claims, ``Neither Alex nor John are knights." Can you find who is a knight and who is a knave?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 5}

We are on the island of knights and knaves . You meet two residents, Alex, Bill who make the following statements:
\begin{align*}
&\text{Alex says: ``One of us, and only one of us, is a knight"}\\
&\text{Bill says: ``Only a knave would say that Alex is a knave"}\\
\end{align*}
Can you find out what Alex and Bill are?


\end{document}

