Homework Assignment #2

  1. If a file is of the length 543246540422 bits, show the file length in the unit of byte, using prefix kilo, mega, giga, and tera , separately. (Up to three digits after the decimal point)

  2. If the execution time of a program is 0.0008723459304 second, write this execution in terms of millisecond, microsecond, and nano second, separately. (Up to three digits after the decimal point)

  3. Convert 503710 and -438210 to binary, octal and hexadecimal numbers using 16-bit two's complement representation. Show 5037-4382 using binary arithmetic operation. Show conversion and calculation steps.

  4. Convert the following binary/octal/hexadecimal numerals to decimal numerals: (a) 101010011101012, (b) 267438, (c) BD039A16.

  5. Convert 2703.62510 to IEEE 754 32-bit single precision floating-point format. Show conversion steps.

  6. Show the calculation of (a) 1268´3048, (b) 4E5916+8D0A16-A58A16.

  7. Explain what is an escape sequence. Write the following texts in boldface courier font as a C string constant with escape sequences.

(a) Are you going to the movie?
Yes, it's still early.
(Note, the strings will be printed in two separate lines.)
(b) 'A'%"123"xyz
(c) Who's book is this?      It's Bob's book, isn't?
(Note, there is a tab character following the question mark.)
(d) \!@#$%^&*()[]{}|_+"',.?/