CS/COE 447: Sp 2010 Homework 1 It's fine to discuss the questions in general with other people but your solutions should be your own individual work. YOUR NAME: Part 1: Decimal, Binary, and Hexadecimal Q1: How many different values can be represented in 8 binary digits (bits)? Q2: How many different values can be represented in 4 hex digits? Q3: Here is an example of adding two binary integers: 01101 + 01101 ------- 11010 Here is how a human does this (we'll look at hardware adders later in the course): Bit 0: 1 + 1 = 10. Write down the 0 and carry the 1. Bit 1: 1 (carry) + 0 + 0 = 1. Write down the 1 (no carry). Bit 2: 1 + 1 = 10. Write down the 0 and carry the 1. Bit 3: 1 (carry) + 1 + 1 = 11. Write down the 1 and carry the 1. Bit 4: 1 (carry) + 0 + 0 = 1. Write down the 1. You can check yourself by converting the integers to decimal. 01101bin = 8 + 4 + 1 = 13dec. So, the sum above is 26dec. The answer we got was 11010 = 16 + 8 + 2 = 26dec. Now you try it with these binary integers: 01011 + 00111 ------- Q4: Consider a binary integer consisting of n 1's. What is this number in decimal? (Hint: look at small numbers such as 1, 11, 111, 1111 to get the idea.) Q5: Suppose you (a human) want to convert a binary integer to decimal. If the number has many ones, it may be quicker to perform subtractions (for the zeros) than additions (for the ones). For example, once you figure out the answer to the previous question, you'll be able to quickly see that 11111bin is 31dec. Suppose you want to convert 11110bin to decimal. It's easy: 31 - 1 = 30. Similarly, 11011bin is 31 - 4 = 27dec, and 10111bin is 31 - 8 = 23dec. Now you try it. Convert the following binary numbers into decimal using this shorthand method. Please show your work: 11 1110 = 11 1011 = 10 1111 = 1011 = 110 = Q6: Please show your work. A. Convert 32 decimal into an 8-bit binary number. B. Convert 15 decimal into an 8-bit binary number. C. What binary number does 0x31FAD283 represent? D. What decimal number does 0x23 represent? E. What decimal number does 100 10010 represent? F. What hexadecimal number does 0011 0100 1101 1100 represent? Part 2: Questions on the materical in Chapter 1 in the text Q7: Sometimes software optimization can dramatically improve the performance of a computer system. Assume that a CPU can perform a multiplication operation in 10 ns and a subtraction operation in 1 ns. How long will it take for the CPU to calculate the result of d = a x b - a x c? Could you optimize the equation so that it will take less time? (Note: ns is short for nanoseconds, or 1 billionth of a second. See the green card in the text for more prefixes.) Q8: Questions 1.1 - 1.26: Match each term in the list with its definition below. Terms: 1 virtual worlds 2 desktop computers 3 servers 4 low-end servers 5 supercomputers 6 terabyte 7 petabyte 8 datacenters 9 embedded computers 10 multi-core processors 11 VHDL 12 RAM 13 CPU 14 operating system 15 compiler 16 bit 17 instruction 18 assembly language 19 machine language 20 C 21 assembler 22 high-level language 23 system software 24 application software 25 cobol 26 fortran 1.1.1 Computer used to run large problems and usually accessed via a network 1.1.2 10^15 or 2^50 bytes (i.e., 10 to the 15 or 2 to the 50) 1.1.3 Computer composed of hundreds to thousands of processors and terabytes of memory 1.1.4 Today's science fiction application that probably will be available in near future 1.1.5 A kind of memory called random access memory 1.1.6 Part of a computer called central processor unit 1.1.7 Thousands of processors forming a large cluster 1.1.8 A microprocessor containing several processors in the same chip 1.1.9 Desktop computer without screen or keyboard usually accessed via a network 1.1.10 Currently the largest class of computer (i.e., there are more of these types of computers than any others) that runs one application or one set of related applications 1.1.11 Special language used to describe hardware components 1.1.12 Personal computer delivering good performance to single users at low cost 1.1.13 Program that translates statements in high-level language to assembly language 1.1.14 Program that translates symbolic instructions to binary instructions 1.1.15 High-level language for business data processing 1.1.16 Binary language that the processor can understand 1.1.17 Commands that the processors understand 1.1.18 High-level language for scientific computation 1.1.19 Symbolic representation of machine instructions 1.1.20 Interface between user's program and hardware providing a variety of services and supervision functions 1.1.21 Software/programs developed by the users 1.1.22 Binary digit (value 0 or 1) 1.1.23 Software layer between the application software and the hardware that includes the operating system and the compilers 1.1.24 High-level language used to write application and system software 1.1.25 Portable language composed of words and algebraic expressions that must be translated into assembly language before run in a computer 1.1.26 10^12 or 2^40 bytes