================================================================= Assignment #07 - Character Encoding and Decoding ================================================================= - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Tuesday March 9, 2010 Upload due date in the Blackboard Assignment Area: Upload "assignment07.txt" before 13:00 (1 pm) on Tuesday March 16, 2010. Do *not* use the DigitalDropbox to submit your answers. Answers will be posted shortly after the due date/time. Submission method: Upload via the "Assignments" CST8281_Assignment_07 upload. Use the file name given above. Upload only one single file of plain text, not HTML, not MSWord, not RTF. No fonts, no word-processing. Plain text only. Did I mention that the format is plain text (Notepad)? Due to bugs in Blackboard, you can only submit your Assignment to me *once*. After that, you cannot submit any more times. If you need to re-submit it, you have to email me to ask me to clear your previous submission. Do *not* use EMail or the DigitalDropbox to submit your answers. Answers will be posted after the due date/time so that you can check your answers before coming to labs and ask questions about the answers in the labs. Please check your answers (and my answers!). I go over each assignment in the lab if there are questions about the answers. No questions means no review - I'll presume you know the material. Questions similar to ones on these assignments will appear on your tests and exams. Not all assignments will be marked. See the Week 1 Notes for details. ============================================================================== Edit this file and answer the following questions underneath each question, showing how you obtained each answer, if appropriate. Answers without methods are worth zero. Upload the file containing the methods and the answers before the due date. Some of the answers below may require reading the URL links published in the weekly notes. ============================================================================== 1. Under what operating system was the following text file created? How do you know? 4C 69 6E 75 78 0D 0A 52 6F 63 6B 73 5C 21 0D 0A 2. Under what operating system was the following text file created? How do you know? 4C 69 6E 75 78 0D 52 6F 63 6B 73 5C 21 0D 3. Under what operating system was the following text file created? How do you know? 4C 69 6E 75 78 0A 52 6F 63 6B 73 5C 21 0A 4. What advantage does UTF-8 have over Unicode for English text? 5. If you sort a file containing lines of mixed-case ASCII text, what is the resulting relationship of lines that begin with upper-case letters and lines that begin with lower-case letters? 6. If you sort a file containing lines of mixed-case EBCDIC text, what is the resulting relationship of lines that begin with upper-case letters and lines that begin with lower-case letters? 7. Why can't a single text file contain both French, encoded as 8-bit Latin-1, and Polish, encoded as 8-bit Latin-2? 8. Encode the following eight ASCII characters in hexadecimal using 8-bit Even Parity: a) A b) a c) B d) b e) C f) c g) D h) d 9. Encode the following eight ASCII characters in hexadecimal using 8-bit Odd Parity: a) A b) a c) B d) b e) C f) c g) D h) d 10. The following ASCII byte is received from a system that generates 8-bit Even Parity: 0xA7 Is there an error in the byte? How do you know? 11. The following ASCII byte is received from a system that generates 8-bit Odd Parity: 0xA5 Is there an error in the byte? How do you know? 12. The following hexadecimal memory dump contains two big-endian four-byte two's-complement integers, starting at address 101. What decimal values do these two big-endian four-byte integers have? ADDRESS: ---------- MEMORY BYTES ---------- 100: FF 01 DF 5E 86 FE 20 A1 79 61 62 63 64 FF C4 F4 A3 1F ... 13. The following hexadecimal memory dump contains two little-endian four-byte two's-complement integers, starting at address 102. What decimal values do these two little-endian four-byte integers have? ADDRESS: ---------- MEMORY BYTES ---------- 100: FF 01 DF 5E 86 FE 20 A1 79 61 62 63 64 FF C4 F4 A3 1F ... 14. What is the byte-ordering (big- or little-endian) of a GIF graphics image? 15. What is the byte-ordering (big- or little-endian) of a JPEG graphics image? 16. What is the byte ordering of Intel-based computers? 17. Given the following partial hexadecimal memory dump of the boot sector of an MS-DOS disk (MS-DOS means an Intel-based PC): 0000: EB 3C 90 4D 53 44 4F 53 35 2E 30 00 02 04 01 00 0010: 02 00 03 00 00 F8 F7 00 12 00 20 00 11 00 00 00 Read the above dump and give the hexadecimal and decimal values of these unsigned integer items of different widths (sizes in bytes): Offset/Size: Value ----------- ------------------------------------------------ a) 000Bh/2: bytes per sector: b) 000Dh/1: sectors per allocation unit (cluster): c) 0010h/1: number of copies of FAT: d) 0011h/2: number of root directory entries: e) 0016h/2: number of sectors per FAT: f) 0018h/2: number of sectors per track: g) 001Ah/2: number of heads: 18. Looking at the previous question: b) What is the maximum number of bytes per sector possible? a) What is the maximum number of copies of the FAT possible? 19. The eight-character ASCII text string "abcdefgh" is stored in memory starting at location zero. a) Give the eight hexadecimal bytes stored in memory: b) Interpret these eight bytes as two 32-bit two's complement integers in little-endian form and give their two decimal values: c) Interpret these eight bytes as four 16-bit two's complement integers in big-endian form and give their four decimal values: d) Add one to each of the four big-endian integers from (c) and give the resulting changed ASCII text string (eight ASCII characters): 20. True/False: Plain English text, encoded as ASCII, is identical to the same Plain English text encoded as UTF-8. 21. True/False: Plain English text, encoded as ASCII, is identical to the same Plain English text encoded as Latin-1. 22. True/False: Plain English text, encoded as ASCII, is identical to the same Plain English text encoded as Unicode. -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/