CSE 2312 - Assignments - Assignment 3

The assignment will be graded out of 100 points. Submit a ZIPPED file (no other formats will be accepted) called assignment3.zip, containing the following three documents:

Submit your assignment3.zip file to Blackboard before the deadline. You will be able to revise your answers until the deadline with no penalty.

IMPORTANT: By submitting your answers, you are certifying that you have followed the UTA standards of academic integrity, and that these answers have been exclusively your own work. All students enrolled in this course are expected to adhere to the UT Arlington Honor Code:

I pledge, on my honor, to uphold UT Arlington's tradition of academic integrity, a tradition that values hard work and honest effort in the pursuit of academic excellence. I promise that I will submit only work that I personally create or contribute to group collaborations, and I will appropriately reference any work from other sources. I will follow the highest standards of integrity and uphold the spirit of the Honor Code.


Task 1 - Programming (20 pts)

We define the following data type, using C-style notation:
struct record
{
   int age;
   char name[12];
   int department;
};
Each int takes four bytes (32 bits) of memory. Each char takes 1 byte (8 bits) of memory. Therefore, if an object of type record is stored in memory, or on file, starting at address base, it is stored in 20 bytes as follows:
from base to (base+3): age
from (base+4) to (base+15): name
from (base+16) to (base+19): department
Write a program (in C, C++, Java, or Python) that can translate files storing such records between big-endian and little-endian. If you are using C, C++, or Java, your program should take three command line arguments: number, input_file, output_file. Similarly, if you are using Python, your function should take in three arguments: number, input_file, output_file. Your program should behave as follows: You should assume that the input file only contains data of type record, and every file location that is a multiple of 20 is the start of a new record.

To help you get started, we provide the following resources:

While we have provided test1_little.bin and test2_big.bin as two test files, we will test your solutions with different test files, so your solution should be able to handle any file following the format we have specified (every file position that is a multiple of 20 is the start of a record).

Submit your solution to this task as a file called (depending on the programming language you use) task1.c, task1.cpp, task1.java, or task1.py. Your solution needs to run on omega.uta.edu, otherwise you will receive at most half credit.


Task 2 - Programming (40 pts.)

Write a program (in C, C++, Java, or Python) that can do parity-bit encoding and decoding of 7-bit words. We will interpret each 7-bit word as an ASCII code. The parity bit should be placed at the END of each codeword.

To make it easy to read and modify input and output files using a text editor, our input and output will be TEXT files, not binary files. As an example, consider 7-bit word 1010100.

If you are using C, C++, or Java, your program should take three command line arguments: number, input_file, output_file. Similarly, if you are using Python, your function should take in three arguments: number, input_file, output_file. Your program should behave as follows:

You should assume that the input file ONLY contains only characters '0' and '1', nothing else (no spaces, new lines, etc.). You should enforce that your output file follows the same convention, and also contains ONLY characters '0' and '1'.

To help you get started, we provide the following resources:

While we have provided these test files, we will test your solutions with different test files, so your solution should be able to handle any file following the format we have specified (containing only '0' and '1' characters).

Submit your solution to this task as a file called (depending on the programming language you use) task2.c, task2.cpp, task2.java, or task2.py. Your solution needs to run on omega.uta.edu, otherwise you will receive at most half credit.


Task 3 (5 pts.)

(This is Problem 10 from Chapter 2 of the textbook).

Genetic information in all living things is coded as DNA molecules. A DNA molecule is a linear sequence of the four basic nucleotides: A, C, G, and T. The human genome contains approximately 3 * 109 nucleotides in the form of about 30,000 genes. What is the total information capacity (in bits) of the human genome? What is the maximum information capacity (in bits) of the average gene?


Task 4 (5 pts.)

(This is Problem 11 from Chapter 2 of the textbook).

A certain computer can be equipped with 1,073,741,824 bytes of memory. Why would a manufacturer choose such a peculiar number, instead of an easy-to-remember number like 1,000,000,000?


Task 5 (10 pts.)

(This is Problem 12 from Chapter 2 of the textbook).

Devise a 7-bit even-parity Hamming code for the digits 0 to 9.


Task 6 (10 pts.)

(This is Problem 13 from Chapter 2 of the textbook).

Devise a code for the digits 0 to 9 whose Hamming distance is 2.


Task 7 (10 pts.)

(This is Problem 14 from Chapter 2 of the textbook).

In a Hamming code, some bits are "wasted" in the sense that they are used for checking and not information. What is the percentage of wasted bits for messages whose total length (data + check bits) is 2n - 1? Evaluate this expression numerically for values of n from 3 to 10.


Back to the list of assignments.