7 Pages

ch02_complete

Course: ECE 495K, Spring 2008
School: Purdue
Rating:
 
 
 
 
 

Word Count: 705

Document Preview

Chapter F.2 2 Solutions 2.1 The answer is 2n 2.2 For 26 characters, we need at least 5 bits. For 52 characters, we need at least 6 bits. 2.3 (a) For 400 students, we need at least 9 bits. (b) 29 = 512, so 112 more students could enter. 2.4 2n integers can be represented. The range would be 0 to (2 n ) - 1. 2.5 If each number is represented with 5 bits, 7 = 00111 -7 = 11000 = 10111 = 11001 2.6 100000. 2.7 Refer the...

Register Now

Unformatted Document Excerpt

Coursehero >> Indiana >> Purdue >> ECE 495K

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Chapter F.2 2 Solutions 2.1 The answer is 2n 2.2 For 26 characters, we need at least 5 bits. For 52 characters, we need at least 6 bits. 2.3 (a) For 400 students, we need at least 9 bits. (b) 29 = 512, so 112 more students could enter. 2.4 2n integers can be represented. The range would be 0 to (2 n ) - 1. 2.5 If each number is represented with 5 bits, 7 = 00111 -7 = 11000 = 10111 = 11001 2.6 100000. 2.7 Refer the following table: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 2.8 The answers are: (a) 127 in decimal, 01111111 in binary. (b) -128 in decimal, 10000000 in binary. (c) (2n-1 )-1 (d) -(2n-1 ) 1 0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1 in all three systems (1's complement) (signed magnitude) (2's complement) 2 2.9 Avogadro's number (6.02 x 1023 ) requires 80 bits to be represented in two's complement binary representation. 2.10 The answers are: (a) -6 (b) 90 (c) -2 (d) 14803 2.11 (a) 01100110 (b) 01000000 (c) 00100001 (d) 10000000 (e) 01111111 2.12 It is a multiple of 4. 2.13 (a) 11111010 (b) 00011001 (c) 11111000 (d) 00000001 2.14 (a) 1100 (b) 1010 (c) 1111 (d) 01011 (e) 10000 2.15 Dividing the number by two. 2.16 (a) 11111111 (binary) or -0 (decimal) (b) 10001110 (binary) or -14(decimal) (c) 00000000 (binary) or 0 (decimal) 2.17 (a) 1100 (binary) or -4 (decimal) (b) 01010100 (binary) or 84 (decimal) (c) 0011 (binary) or 3 (decimal) (d) 11 (binary) or -1 (decimal) 2.18 The answers are: (a) 1100 (binary) or 12 (decimal) F.2. CHAPTER 2 SOLUTIONS (b) 1011000 (binary) or 88 (decimal) (c) 1011 (binary) or 11 (decimal) (d) 11 (binary) or 3 (decimal) 2.19 11100101, 1111111111100101, 11111111111111111111111111100101. does not affect the value represented. 2.20 (a) 1100 + 0011 = 1111 -4 + 3 = -1 (b) 1100 + 0100 = 0000 -4 + 4 = 0 (c) 0111 + 0001 = 1000 OVERFLOW! 7 + 1 = -8 (d) 1000 - 0001 = 1000 + 1111 = 0111 OVERFLOW! -8 - 1 = -8 + (-1) = 7 (e) 0111 + 1001 = 0000 7 + -7 = 0 3 Sign extension 2.21 Overflow has occurred if both operands are positive and the result is negative, or if both operands are negative and the result is positive. 2.22 Any two 16-bit 2's complement numbers that add to more than +32767 or less than -32768 would be correct. 2.23 Overflow has occurred in an unsigned addition when you get a carry out of the leftmost bits. 2.24 Any two 16-bit unsigned numbers that add to more than 65535 would be correct. 2.25 Because their sum will be a number which if positive, will have a lower magnitude (less positive) than the original postive number (because a negative number is being added to it), and vice versa. 2.26 (a) 7 bits. (b) 63 in decimal ( 0111111 in binary ) (c) 127 in decimal ( 1111111 in binary ) 2.27 The problem here is that overflow occurred has as adding 2 positive numbers has resulted in a negative number. 2.28 When all of the inputs are 1. 2.29 Refer to the following table: X 0 0 1 1 Y 0 1 0 1 X AND Y 0 0 0 1 4 2.30 (a) 01010111 (b) 100 (c) 10100000 (d) 00010100 (e) 0000 (f) 0000 2.31 When atleast one of the inputs is 1. 2.32 Refer to the following table: X 0 0 1 1 Y 0 1 0 1 X OR Y 0 1 1 1 2.33 (a) 11010111 (b) 111 (c) 11110100 (d) 10111111 (e) 1101 (f) 1101 2.34 (a) 0111 (b) 0111 (c) 1101 (d) 0110 2.35 The masks are used to set bits (by ORing a 1) and to clear bits (by ANDing a 0). 2.36 (a) AND with 11111011 (b) OR with 01000100 (c) AND with 00000000 (d) OR with 11111111 (e) AND the BUSYNESS pattern with 00000100 to isolate b2. Then add that result to itself 5 times. 2.37 [(n AND m AND (NOT s)) OR ((NOT n) AND (NOT m) AND s)] AND 1000 2.38 Let N = n & 1000, M = m & 1000 Overflow = (N AND M) OR ((N OR M) AND ((NOT s) AND 1000)) F.2. CHAPTER 2 SOLUTIONS 2.39 (a) 0 10000000 11100000000000000000000 (b) 1 10000100 10111010111000000000000 (c) 0 10000000 10010010000111111011011 (d) 0 10001110 11110100000000000000000 2.40 (a) 2 (b) -17 (c) Positive infinity. NOTE: This was not explained in the text. (d) -3.125 2.41 (a) 127 (b) -126 5 2.42 The ASCII values are being added, rather than the integer values. (ASCII "5" is 53 in decimal, and ASCII "8" is 56 in decimal, adding to 109, which is ASCII "m".) 2.43 (a) Hello! (b) hELLO! (c) Computers! (d) LC-2 2.44 Add 0011 0000 (binary) or x30. 2.45 (a) xD1AF (b) x1F (c) x1 (d) xEDB2 2.46 (a) 0001 0000 (b) 1000 0000 0001 (c) 1111 0111 0011 0001 (d) 0000 1111 0001 1110 0010 1101 (e) 1011 1100 1010 1101 2.47 (a) -16 (b) 2047 (c) 22 (d) -32768 2.48 (a) x100 (b) x6F (c) x75BCD15 6 (d) xD4 2.49 (a) x2939 (b) x6E36 (c) x46F4 (d) xF1A8 (e) The results must be wrong. In (3), the sum of two negative numbers produced a positive result. In (4), the sum of two positive numbers produced a negative result. We call such additions OVERFLOW. 2.50 (a) x5468 (b) xBBFD (c) xFFFF (d) x32A3 2.51 (a) x644B (b) x4428E800 (c) x48656C6C6F 2.52 Refer to the table below. Unsigned Binary 1's Complement 2's Complement IEEE 754 floating point ASCII String 2.53 Refer to the table below: A B Q1 Q2 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 1 Q2 = A OR B 2.54 Refer to the table below: X Y Z Q1 Q2 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 x434F4D50 1,129,270,608 1,129,270,608 1,129,270,608 207.302001953125 COMP x55544552 1,431,586,130 1,431,586,130 1,431,586,130 14,587,137,097,728 UTER F.2. CHAPTER 2 SOLUTIONS 2.55 (a) 63 (b) 4n - 1 (c) 310 (d) 222 (e) 11011.11 (f) 0100 0001 1101 1110 0000 0000 0000 0000 (g) 44m 2.56 - 1.101 x 2(12-7) = -52 7
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Purdue - ECE - 495K
F.3 Chapter 3 Solutions3.1 Gate=1 Gate=0 3.2 N-Type closed open P-Type open closedP Type IN = 1 OUT = 0 N Type3.3 There can be 16 different two input logic functions. 3.4 A 0 0 1 1 B 0 1 0 1 C 1 0 0 0AP TypeBP Type C=1N Type N TypeF.
Purdue - ECE - 495K
F.4 Chapter 4 Solutions4.1 Components of the Von Neumann Model: (a) Memory: Storage of information (data/program) (b) Processing Unit: Computation/Processing of Information (c) Input: Means of getting information into the computer. e.g. keyboard, mo
Purdue - ECE - 495K
F.5 Chapter 5 Solutions5.1 (a) ADD - operate - register addressing for destination and source 1 - register or immediate addressing for source 2 (b) JMP - control - register addressing (c) LEA - data movement - immediate addressing (d) NOT - operate
Purdue - ECE - 495K
F.6 Chapter 6 Solutions6.1 Yes, for example, an iterative block where the test condition remains true for each iteration. This procedure will never end and is therefore not finite and not an algorithm. The following is an example of a procedure that
Purdue - ECE - 495K
F.7 Chapter 7 Solutions7.1 0xA7FE 7.2 0x23FF 7.3 Using an instruction as a label confuses the assembler because it treats the label as the opcode itself so the label AND will not be entered into the symbol table. Instead the assembler will give an e
Purdue - ECE - 495K
F.8 Chapter 88.1 (a) A device register is a register (or memory location) that is used for data transfer to/from an input/output device. It provides a means of communication between the processor and the input/output device. The processor can poll t
Purdue - ECE - 495K
F.9 Chapter 9 Solutions9.1 The most important advantage of doing I/O through a trap routine is the fact that it is not necessary for the programmer to know the gory low-level details of the specific hardware's input/output mechanism. These details i
Purdue - ECE - 495K
F.10 Chapter 10 Solutions10.1 The defining characteristic of a stack is the unique specification of how it is to be accessed. Stack is a LIFO (Last in First Out) structure. This means that the last thing that is put in the stack will be the first on
Purdue - ECE - 495K
Chapter 1111.1 a. b. c. d. Correctness: Easy to make mistakes when programming in assembly Debugging: Hard to find bugs in programs written in assembly Programming: Code has to be expressed at a very low level Readability: Assembly code is hard to r
Purdue - ECE - 495K
Chapter 1212.1 Name cc dd ff ii 12.2 Type char char float int Offset -1 -3 0 -2 Scope BlockA BlockA (i.e., same block as cc) BlockA (i.e., same block as cc.) BlockA (i.e., same block as cc.)1. If r is a local variable, then it will not be initiali
Purdue - ECE - 495K
Chapter 1313.1. Name operand1 operand2 operation result 13.2. a. if (-2) printf("True!"); else printf("False!"); "True!" The modified code will not behave differently. Type int int char int Offset 0 -1 -3 -2 Scope main main main mainb. c. 13.3.i
Purdue - ECE - 495K
Chapter 1414.1. The function main() is the place in a C program where execution begins. A program without a function main() has no starting point. 14.2. a. When a function is called, the address of the caller's activation record on the runtime stack
Purdue - ECE - 495K
Chapter 1515.1 a. #include <stdio.h> int main() { int i = 1; int sum = 0; while(i < 11) { sum = sum + i; +i; } printf("%d\n",sum);}b.#include <stdio.h> int main() { int i; int sum = 0; for (i = 0; i <= 10; +i) sum = sum + i; printf("%d\n",sum)
Purdue - ECE - 495K
Chapter 1616.1 int changeToPL(char * word) { int i = 1; char first = word[0]; if (first = '\0') return -1; while (word[i] != '\0') word[i - 1] = word [i]; word[i] = first; word[i + 1] = 'a'; word[i + 2] = 'y'; word[i + 3] = '\0';}16.2 void Runni
Purdue - ECE - 495K
Chapter 1717.1 a) b) c) d) e) f) 17.2 Not necessarily. A recursive function can have multiple recursive call sites (such as Movedisk, BinarySearch, or Fibonacci), each which will have its own return address. Recursive functions with one call site ar
Purdue - ECE - 495K
Chapter 1818.1 a. b. c. d. e. 18.2 The return value of scanf is the number of format specifications that were successfully scanned in the input stream. 18.3 So that the user can edit the input stream before hitting enter and thereby confirming the i
Carnegie Mellon - HIST - 79275
Villanova - PHY - 2400
Villanova - PHY - 2400
Villanova - PHY - 2400
Purdue - PSY - 120
THERAPYBio-Psycho-Socialtalk therapy (CBT) affects the front part of the brain Paxil works on primitive region, (back brain) (right, red)Psychopharmacology: 1. Antidepressants 2. Stimulants 3. Mood stabilizer 4.Antianxiety 5. Antipsyc
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 3Spring 2000Page 1/5Page 1 Page 2 Page 3 Page 4/10 /22 /28 /16 /24 /100RECITATION INSTRUCTOR RECITATION TIMEPage 5 TOTALDIRECTIONS 1. Write your name, student ID number, recitation instructor's name and reci
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 2Spring 2000Page 1/5Page 1 Page 2 Page 3 Page 4/12 /28 /22 /20 /18 /100RECITATION INSTRUCTOR RECITATION TIMEPage 5 TOTALDIRECTIONS 1. Write your name, student ID number, recitation instructor's name and reci
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 2Spring 2001Page 1/4Page 1 Page 2 Page 3 Page 4/18 /30 /30 /22 /100RECITATION INSTRUCTOR RECITATION TIME DIRECTIONSTOTAL1. Write your name, student ID number, recitation instructor's name and recitation time
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 2Spring 2004Page 1/4Page 1 Page 2 Page 3 Page 4/12 /36 /30 /22 /100RECITATION INSTRUCTOR RECITATION TIME DIRECTIONSTOTAL1. Write your name, student ID number, recitation instructor's name and recitation time
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 2Spring 2005Page 1/4Page 1 Page 2 Page 3 Page 4/14 /30 /34 /22 /100RECITATION INSTRUCTOR RECITATION TIME DIRECTIONSTOTAL1. Write your name, student ID number, recitation instructor's name and recitation time
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 2Spring 1999Page 1/5Page 1 Page 2 Page 3 Page 4/17 /18 /20 /23 /18 /100RECITATION INSTRUCTOR RECITATION TIMEPage 5 TOTALDIRECTIONS 1. Write your name, student ID number, recitation instructor's name and reci
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 3Spring 2004Page 1/4Page 1 Page 2 Page 3 Page 4/14 /18 /32 /36 /100RECITATION INSTRUCTOR RECITATION TIMETOTALDIRECTIONS 1. Write your name, student ID number, recitation instructor's name and recitation time
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
MA 166 NAME STUDENT IDEXAM 3Spring 1999Page 1/5Page 1 Page 2 Page 3 Page 4/12 /17 /26 /20 /25 /100RECITATION INSTRUCTOR RECITATION TIMEPage 5 TOTALDIRECTIONS 1. Write your name, student ID number, recitation instructor's name and reci
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
Purdue - MA - 166
LA Tech - HIST - 201
The Rise and Decline of the StateThe state, which since the middle of the seventeenth century has been the most important and most characteristic of all modern institutions, is in decline. From Western Europe to Africa, many existing states are eit
Columbia - ANTH - V1008
Columbia - ANTH - V1008
State and society at Teotihuacan, MexicoGeorge L Cowgill Annual Review of Anthropology; 1997; 26, Research Library pg. 129Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.Reproduced with permi
Columbia - ANTH - V1008
Early Chinese Writing William G. Boltz World Archaeology, Vol. 17, No. 3, Early Writing Systems. (Feb., 1986), pp. 420-436.Stable URL: http:/links.jstor.org/sici?sici=0043-8243%28198602%2917%3A3%3C420%3AECW%3E2.0.CO%3B2-3 World Archaeology is curren