CPSC 121 2021S2
HW 2
Solutions
Instructions:
1. Do not change the problem statements we are giving you. Simply add your solutions by
editing this latex document. To make it easier for the TAs to find your solutions, please use
the soln environment we provided as follows:
\begin{soln}
My solution is here.
\end{soln}
Your solution will then appear in blue, and be easier to differentiate from the questions.
2. If you need more space, add a page between the existing pages using the \newpage com-
mand.
3. Export the completed assignment as a PDF file for upload to gradescope.
4. On Gradescope, upload only one copy per partnership. You must identify you group via
Gradescope; not doing so may result in losing some marks.
5. You must also tell us, via Gradescope, where each of the problem parts appears on your
submission. You MUST align the regions for every problem, even if your assignment solution
isn’t complete. We will not be able to mark any problem we can’t find. After uploading
the .pdf you will a screen, where you can click each question on the left, and click the
corresponding page(s) on which the question appears. Because of this matching process,
please allocate at least 5 minutes prior to the deadline for submission. You must match your
answers with each question, not doing so may result in losing some marks.
Academic Conduct: I certify that my assignment follows the academic conduct rules
for of CPSC 121 as outlined on the course website. As part of those rules, when collaborating
with anyone outside my group, (1) I and my collaborators took no record but names away,
and (2) after a suitable break, my group created the assignment I am submitting without
help from anyone other than the course staff.
1
, CPSC 121 2021S2
1. [4 marks] Computers represent characters by associating with each character a specific
sequence of 0’s and 1’s. For the basic characters, the standard seven-bit ASCII characters
is used. For this question, we will use the standard ASCII table that you can find on
https://bournetocode.com/projects/GCSE_Computing_Fundamentals/pages/img/ascii_
table_lge.png
a. [2 marks] Using the table, tell what sentence is represented by the following numbers:
84 104 101 32 97 110 115 119 101 114 32 105 115 32 52 50 46
The answer is 42.
b. [2 marks] Draw a simple circuit that takes in 7 inputs b6 , b5 , . . . , b0 corresponding
to a letter in ASCII code (from A-Z), and outputs the position of this letter in the
Latin alphabet, i.e., A is 1, B is 2, C is 3, ..., and Z is 26. HINT: you may find useful
patterns in the binary representations of the letters.
2
HW 2
Solutions
Instructions:
1. Do not change the problem statements we are giving you. Simply add your solutions by
editing this latex document. To make it easier for the TAs to find your solutions, please use
the soln environment we provided as follows:
\begin{soln}
My solution is here.
\end{soln}
Your solution will then appear in blue, and be easier to differentiate from the questions.
2. If you need more space, add a page between the existing pages using the \newpage com-
mand.
3. Export the completed assignment as a PDF file for upload to gradescope.
4. On Gradescope, upload only one copy per partnership. You must identify you group via
Gradescope; not doing so may result in losing some marks.
5. You must also tell us, via Gradescope, where each of the problem parts appears on your
submission. You MUST align the regions for every problem, even if your assignment solution
isn’t complete. We will not be able to mark any problem we can’t find. After uploading
the .pdf you will a screen, where you can click each question on the left, and click the
corresponding page(s) on which the question appears. Because of this matching process,
please allocate at least 5 minutes prior to the deadline for submission. You must match your
answers with each question, not doing so may result in losing some marks.
Academic Conduct: I certify that my assignment follows the academic conduct rules
for of CPSC 121 as outlined on the course website. As part of those rules, when collaborating
with anyone outside my group, (1) I and my collaborators took no record but names away,
and (2) after a suitable break, my group created the assignment I am submitting without
help from anyone other than the course staff.
1
, CPSC 121 2021S2
1. [4 marks] Computers represent characters by associating with each character a specific
sequence of 0’s and 1’s. For the basic characters, the standard seven-bit ASCII characters
is used. For this question, we will use the standard ASCII table that you can find on
https://bournetocode.com/projects/GCSE_Computing_Fundamentals/pages/img/ascii_
table_lge.png
a. [2 marks] Using the table, tell what sentence is represented by the following numbers:
84 104 101 32 97 110 115 119 101 114 32 105 115 32 52 50 46
The answer is 42.
b. [2 marks] Draw a simple circuit that takes in 7 inputs b6 , b5 , . . . , b0 corresponding
to a letter in ASCII code (from A-Z), and outputs the position of this letter in the
Latin alphabet, i.e., A is 1, B is 2, C is 3, ..., and Z is 26. HINT: you may find useful
patterns in the binary representations of the letters.
2