Lab #2: Encoding information in bits and bytes: numbers,
text, and images (6 Points)
Record in the weekly progress report all the answers or results you have
after accomplishing the following tasks.
Task 1: Binary
numbers to Decimal numbers
- Convert each of the following
five binary numbers (each as an 8-bit binary string) into corresponding
decimal numbers: 01000010, 01101001, 01101111, 01101100, and
01100001. (See how to convert
between binary and decimal numbers.) Determine and record in your report what
the corresponding decimal numbers are.
Task 2: Decimal
numbers to Binary numbers
Consider 106 and 233 as two decimal numbers. Determine and
record in your report what the corresponding 8-bit binary numbers are.
(See how to
convert between binary and decimal numbers).
Task 3: Numbers to Characters
- Suppose
the 5 bytes of information in Task
1 above are stored as a part of a text file to encode 5 characters
(i.e. one byte for each character) using the ASCII character set
encoding. Determine
and record in your report what the five characters are.
Task 4:
Measuring the size of text files
- Use
WordPad or NotePad to create four text files of
about 100 characters, 200 characters, 400 characters, and 800 characters
respectively and save them as text files ( i.e. .txt
files). Record and report the sizes of these files (in terms of bytes).
Note that it takes one byte to record a character. Is the number of characters in each
file close to the corresponding file size you see? (Yes, or No).
Task 5:
Measuring the sizes of pictures in the BMP file format.
- (i) Press the print screen key on the keyboard to
capture the screen as a picture. Open up Microsoft Paint, paste the image
into the canvass, and save it as a 24-bit bitmap file (
.BMP file). Check the file size and record it in your report. (ii)
On Windows 7 right click on
your windows desktop ==> Personalize
==> Screen Resolution (If it is on Windows XP, instead right click on your windows
desktop ==> property ==> settings) to get the information
regarding the resolution of your screen. What is your screen resolution X x Y? Record it in your report. For example, the resolution is 1400 x 1024 for
the instructor’s computer in Lib 141. (iii) Note that if you have a screen resolution of X by Y you have X*Y
pixels on the screen in total, the BMP file uses 24 bits (i.e. 3 bytes) to
record the color of each pixel, and it will take X*Y*3 bytes in the BMP
file to store the information of your screenshot. Also note that 1 MB
means 1 million bytes. Record
in your progress report whether X*Y*3 is close to the actual BMP file
size.
Task 6:
Measuring the speed of the CPU
- Download and unzip this zipped file to
get a Windows executable file (Speed.exe) and a C++ program project folder
(Speed). Double click Speed.exe to run the program to get a feeling
about how fast the computer can do number crunching. (Optional: If you
like, you can also open the Visual C++ project in Speed folder to see the
C++ code.) Report
in your report how much time does it take for your computer to finish
1,000,000,000 additions.