DOC PREVIEW
UIUC ECE 190 - ECE120 HW3

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE120 HW3ECE120 AB3 1. Because, according to ASCII Table, number 0 to 9 is represented by consecutive binary patterns starting with 0011 and ending from 0000 to 1001. So it is much easier for the computer to compute some calculation with numbers, which only change in the last four digits of binary code.2. Strings only consist one ‘1’ :4 Strings only consist three ‘1’ :4 a) Numbers of codeword of C:4+4=8 b) 23. a) 5 b)64. NOT(XOR) should be applied. Because bits like 00 and 11 would have odd parity 1; bits like 10 and 01 would have odd parity 0. As shown in the figure, it would be the reverse version of XOR, so NOT(XOR) should be applied.5. a) 0100 0100 0100 1111 0100 1110 0100 0101 2^0+2^2+2^6+2^9+2^10+2^11+2^14+2^16+2^17+2^18+2^19+2^22+2^26+2^30 =1146048069 b) 1146048069 c) 1146048069 d) 0 10001000 10011110100111001000101 + Exp.=136-127=9 Fraction=1. 10011110100111001000101 +1100111101.00111001000101 =2^0+2^2+2^3+2^4+2^5+2^8+2^9+2^-3+2^-4+2^-5+2^-8+2^-12+2^-14 =829.222961425781251e) DONE6. a) xA = 1010 x7 XOR x5 XOR x3 XOR x1 = 0 ==> x1 = 0 x7 XOR x6 XOR x3 XOR x2 = 0 ==> x2 = 1 x7 XOR x6 XOR x5 XOR x4 = 0 ==> x4 = 0 xA = 1010010 b) x7 = 0111 x7 XOR x5 XOR x3 XOR x1 = 0 ==> x1 = 0 x7 XOR x6 XOR x3 XOR x2 = 0 ==> x2 = 0 x7 XOR x6 XOR x5 XOR x4 = 0 ==> x4 = 0 x7 = 0110100 c) xC = 1100 x7 XOR x5 XOR x3 XOR x1 = 0 ==> x1 = 1 x7 XOR x6 XOR x3 XOR x2 = 0 ==> x2 = 0 x7 XOR x6 XOR x5 XOR x4 = 0 ==> x4 = 0 xC = 11000017. 1111001 ==> four bits code: 1110 check bits: 101 For x4 ==> 1+1+1+1=0 ==> correct For x2 ==> 1+1+0+0=0 ==> correct For x1 ==> 1+1+0+1=1 ==> ERROR 1110001 ==> four bits code: 1110 check bits: 001 For x4 ==> 1+1+1+0=1 ==> ERROR For x2 ==> 1+1+0+0=0 ==> correct For x1 ==> 1+1+0+1=1 ==> ERROR 1111000 ==> four bits code: 1110 check bits: 100 For x4 ==> 1+1+1+1=0 ==> correct2For x2 ==> 1+1+0+0=0 ==> correct For x1 ==> 1+1+0+0=0 ==> correct So, the original message should be EEE8. scanf(“%d”, &letter) printf( “Your letter was: %c”, letter)9. a) D b) y>0 c) B10. if( ( (ascii => ‘0’)&&(ascii <= ‘9’) )||( (ascii => ‘A’)&&( ascii <= ‘Z’) )||( (ascii => ‘a’)&&(ascii <= ‘z’) printf(“%c” , ascii)11./* * * power_of_five.c: Computes 5 to the power of a positive integer * */#include <stdio.h>int main(){ /* Declare variables */ int counter; /* loop counter */ int product; /* result, 5^N */ int endCount; /* power N */3/* Read value of N */ printf("This program will compute 5^N; enter N: "); scanf("%d", &endCount); if (endCount < 0) printf("The operation is undefined for negative integers") else /* Compute 5^N */ product = 1; for (counter = 1; counter <= endCount; counter = counter + 1) { product = 5*product; } if (product > 2^31-1) printf("The value exceeds the supported numerical range") else /* Print the answer */ printf("%d\n", product); return


View Full Document

UIUC ECE 190 - ECE120 HW3

Documents in this Course
Load more
Download ECE120 HW3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ECE120 HW3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ECE120 HW3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?