------------------------- Week 05 Notes for CST8281 ------------------------- -Ian! D. Allen - idallen@idallen.ca - www.idallen.com Calculators are not permitted during the first midterm test. You will benefit from knowing the powers of two from 2**(-4) to 2**16 and the decimal and binary values of the hexadecimal digits from zero to fifteen. Of course you can work them out; however, having at least some of them memorized will make things go faster for you on the test. (Remember that hexadecimal "A" = decimal 10 = binary 1010.) Topics ------ Midterm (Thursday) and Midterm Review (Friday) Line-ends for text files (LF, CR, and CR+LF) Simple even/odd parity Endian-ness UTF-8 Logical Right Shift, Arithmetic Right Shift, Left Shift (multiply by two) Lecture Notes for This Week --------------------------- - From Blackboard Course Documents (publisher-restricted distribution): 02.ppt Character representations (EBCDIC, ASCII, Unicode, UTF-8 and friends) - 080_byte_order_endian.html Byte Order - Big and Little Endian - 120_CharacterEncoding.html Character Encoding (and line ends) - http://en.wikipedia.org/wiki/ASCII - http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code - http://en.wikipedia.org/wiki/Newline - http://en.wikipedia.org/wiki/Unicode - http://en.wikipedia.org/wiki/Parity_bit - http://en.wikipedia.org/wiki/Endianness - http://en.wikipedia.org/wiki/Arithmetic_shift References: - http://en.wikipedia.org/wiki/Tengwar ("Elvish script": see "Unicode" section) ----------------------------------- Midterm Test #1 - October 7, 2010 ----------------------------------- Calculators are not permitted during the first midterm test. You will benefit from knowing the powers of two from 2**(-4) to 2**16 and the decimal and binary values of the hexadecimal digits from zero to fifteen. Of course you can work them out; however, having at least some of them memorized will make things go faster for you on the test. (Remember that hexadecimal "A" = decimal 10 = binary 1010.) Answer Sheet 010 1100 1010 1011 1101 1110 1111 = 2 C A B D E F 9BA + B11 = 4CB C O 801 + 7FF = 000 Z C OK-SIGN 796 + 514 = CAA S O OK-UNSIGN FFF + FFF = FFE C S OK-SIGN 800 + 800 = 000 Z C O 1196 = 4*16**2 + 10*16**1 + 12 = 04AC -1197 = FB53 (add one to 04AC above to get 04AD, complement, add one) -1 = FFFF 1 / (3.33+ GHz) = 1/3.33+ * 1/10**9 = 0.3 * 10**(-9) = 0.3 ns 1 / (25 ns) = 1/25 * 1/10**(-9) = 1/25 * 10**9 = 1/25 * 10**3 * 10**6 = 10**3/25 MHz = 40 MHz 2**24 = 2**4 * 2**20 = 16 MiBi 0.6875 = 0.5 + 0.125 + 0.0625 = 0.1011(2) in binary 32,768 < 32,770 < 65,536 2**15 < 32,770 < 2**16 --> 16 bits ASCII 'A' = 0x41 so Unicode 'A' = 0x0041 IEEE 754 32-bit floating point number max = 10**38 10 bits = 2**10 = 1024 numbers - signed means half (512) are positive and half (512) are negative --> Smallest: -512 Largest: +511 Giga / Kilo = 10**9 / 10**3 = 10**6 = a million tera = 1024 Giga = 2**10 * 2**30 = 2**40 milli / nano = 10**(-3) / 10**(-9) = 10**6 = six orders of magnitude IETF - Internet Engineering Task Force 111(-2) = (-2)**2 + (-2)**1 + (-2)**0 = 4 + -2 + 1 = 3 ASCII Upper Case sorts before Lower Case, e.g. 'A' < 'a' (a'b')' == ab --> FALSE because (a'b')' = a'' + b'' = a+b (deMorgan) (a' + b')' == a + b --> FALSE because (a' + b')' = a''b'' = ab (deMorgan) Call the ADD routine unless the COST is greater than zero and the CODE is sold --> IF NOT( COST > 0 AND CODE == sold ) call ADD : original --> IF NOT(COST > 0) OR NOT(CODE == sold) call ADD : deMorgan --> IF COST <= 0 OR CODE != sold call ADD : complement --> IF COST <= 0 || CODE != sold call ADD : answer Class results from the first midterm test: ------------------------------------------ 67.3 55.8 55.8 48.1 40.4 36.5 36.5 34.6 26.9 23.1 -- | 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/