Description
CSCI 463-1 Computer Systems Organization Spring 2025 Homework #8 explores computer data representation, including endianness, Unicode, ASCII, UTF-8, UTF-16, and UTF-32 encoding. The assignment covers binary file interpretation, hexadecimal byte ordering, character encoding sizes, Unicode code points, normalized and denormalized floating-point numbers, and assembler symbol tables.
Original Assignment / Project Question
I. Endianness
Consider the following C++ program:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
int i = 0x87654321;
char u[5] = "unix";
ofstream myfile;
myfile.open("fileout.txt", ios::binary);
myfile.write((char *)&i, sizeof(i));
myfile.write((char *)u, 4);
myfile.close();
}
- Run this program on turing/hopper.
- a) List the characters in the output file in hex in increasing order. Here is one way to see the characters in order; there are surely others:
emacs -nw fileout.txt
<esc>x hexl-mode
<cntl>x<cntl>c
These commands use the hexadecimal mode of the Emacs editor. The display includes byte addresses, hexadecimal byte values, and ASCII representations.
b) What does this tell you about turing/hopper: are they big-endian or little-endian? How do you know?
c) Run the following command:
od -t cx1 fileout.txt
Explain the result, i.e., what do you see, and why? (Use man od if you need more information.)
d) Same as previous question using the following command:
od -t cx2 fileout.txt
e) Same as previous question using the following command:
od -t cx4 fileout.txt
f) Run the following command:
od -t cx fileout.txt
What does this tell you about the default value for the x value of the -t operand of od?
II. Character Representation
2. Show the representation of each of the given strings in each of the formats listed.
| String | Coding system | Representation |
|---|---|---|
| ‘Bb2’ | Unicode (code points) | a) |
| ‘Bb2’ | Ascii (hex) | b) |
| ‘Bb2’ | UTF 8 (hex) | c) |
| ‘óáé’ | Unicode (code points) | d) |
| ‘Ūūš’ | Unicode (code points) | e) |
3. How many bytes would each of the given strings occupy in the given format?
| String | Ascii | UTF-8 | UTF-16 | UTF-32 |
|---|---|---|---|---|
| ‘Bb2’ | ||||
| ‘óáé’ | — | |||
| ‘Ūūš’ | — |
4. Show the representation of each of the following values as a single hex byte.
| Value | Hex byte |
|---|---|
| unsigned binary 3 | a) |
| binary +3 (two’s complement form) | b) |
| binary -3 (two’s complement form) | c) |
| Ascii ‘3’ | d) |
| UTF 8 ‘3’ | e) |
5. Character Subsets
Fill in the following chart on the answer sheet. For each symbol, look up its Unicode name and specify whether it belongs to the ASCII subset of Unicode, ISO 8859-1, and the Basic Multilingual Plane (BMP).
| Symbol | Unicode code point | In ASCII? | In ISO 8859-1? | In BMP? | Unicode name |
|---|---|---|---|---|---|
| o | U+006F | ||||
| ö | U+00F6 | ||||
| ☺ | U+263A | ||||
| 🦃 | U+1F983 |
The assignment also discusses older Unicode terminology such as white, black, and heavy, referring to graphical character appearance.
6–8. Unicode Encoding Tables
Fill in the charts showing how many Unicode code points in the Basic Multilingual Plane require one, two, three, or four bytes under UTF-8, UTF-16, and UTF-32.
Express code points as U+hhhh, where hhhh is a four-digit hexadecimal number.
The BMP extends from U+0000 to U+FFFF. The range U+D800 through U+DFFF is excluded from valid character code points, leaving 63,488 entries for the calculations.
UTF-8
| Category | Decimal range | First code point | Last code point | 1 byte | 2 bytes | 3 bytes | 4 bytes |
|---|---|---|---|---|---|---|---|
| ASCII | 0–127 | ||||||
| Extended ASCII ISO 8859-1 | 128–255 | ||||||
| Rest of BMP | 256–65535 |
UTF-16
| Category | Decimal range | First code point | Last code point | 1 byte | 2 bytes | 3 bytes | 4 bytes |
|---|---|---|---|---|---|---|---|
| ASCII | 0–127 | (same) | (same) | ||||
| Extended ASCII ISO 8859-1 | 128–255 | (same) | (same) | ||||
| Rest of BMP | 256–65535 | (same) | (same) |
UTF-32
| Category | Decimal range | First code point | Last code point | 1 byte | 2 bytes | 3 bytes | 4 bytes |
|---|---|---|---|---|---|---|---|
| ASCII | 0–127 | (same) | (same) | ||||
| Extended ASCII ISO 8859-1 | 128–255 | (same) | (same) | ||||
| Rest of BMP | 256–65535 | (same) | (same) |
9. Relationship Between Normalized and Denormalized Numbers
a) For a given standard, the smallest normalized number is approximately equal to the largest denormalized number. Why?
b) If you don’t round off, which of the two is always larger? Why?
10. Assembler Symbol Table
Consider the following assembly program. The answer sheet contains an assembler symbol table showing the values of entries after each line of code.
Leave entries blank until the variable first appears. Enter 000 when a variable has been added but has not yet been assigned a value. Highlight each new or changed value.
The assignment provides the first two completed rows and the first column as examples of the benefits of a two-pass assembler.
100 LOAD Addr Initialize Next with
101 STORE Next starting address
102 LOAD Num Initialize Ctr
103 ADD Num1
104 STORE Ctr
105 Loop LOAD Sum
106 SUBT Num1
107 STORE Sum
108 JUMP Loop
109 Addr HEX 114
110 Next HEX 0
111 Num DEC 5
112 Sum DEC 16
113 Ctr HEX 0
114 Num1 DEC 10
Complete the remaining symbol table entries, tracking when symbols are introduced and when their hexadecimal values become available.
Solution Overview
The solution covers endianness identification, hexadecimal file output interpretation, Unicode code point conversions, character encoding byte counts, and completed UTF encoding tables. It also addresses normalized versus denormalized floating-point values and assembler symbol table entries for the provided program.
Downloadable ZIP File
The downloadable ZIP file contains the CSCI 463-1 Spring 2025 Homework #8 solution and relevant assignment materials covering endianness, character representation, Unicode encoding, and assembler symbol tables.
Get the Assignment Resource
Explore this downloadable resource for educational reference and independent study. Need help with another computer systems or programming assignment? Request Custom Programming Assistance.


