Winter ’18 CIS 314 Midterm A Name: SID: 1. [5] What is the decimal value of the byte 0x38, interpreted as an 8-bit unsigned int? Show your work: 2. [5] What is the decimal value the of byte 0x38, interpreted as an 8-bit (signed) int? Show your work: 3. [5] What is the decimal value of the byte 0x83, interpreted as an 8-bit (signed) int? Show your work: 4. [10] What is the hex value of x >> 4, assuming x is a 32-bit (signed) int with hex value 0x83838383? Show your work: 5. [15] What is the decimal value of 0xC1540000, interpreted as an IEEE-754 signle-precision float? Show your work: 6. [15] Consider the follow C function: int isNegativeZero(float f); Implement the above function such that it will return 1 if f == -0.0f, 0 otherwise. Do this using only bitwise operators (ands, ors, shifts) and integer equality (==); no floating-point operations, if statements, or loops. Hint: access the bit representation of f by casting its address to an unsigned-int pointer (similar t代写留学生Winter 18 CIS 314课程设计、R编程代写、帮做R编程作业、R语言代做留学生、调试R作业、R作业调o assignment 2), then test the value at this pointer against the expected IEEE-754 bit representation for -0.0 as hex. Comment your code: 7. [20] Consider the following IA32 code, resulting from compiling a function int f(int x, int y): pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 12(%ebp), %ecx leal 10(%ecx,%eax,8), %eax popl %ebp retl a. (15) Convert the above code to C. Comment your code: b. (5) What is returned by f(1, 2)? Show your work: 8. [25] Consider the following C code: int popCount(unsigned int x) { int result = 0; do { result += x 0x1; x >>= 1; } while (x); return resu} a. (10) The above code counts the number of 1s in the bit representation of x. Rewrite the code (in C) to use a label and goto statement rather than a loop. Comment your code: b. (15) Convert your C code from part A above into IA32, ensuring that register use is correct with respect to the IA32 register conventions. Comment your code: 转自:http://ass.3daixie.com/2018110120083443.html
讲解:Winter 18 CIS 314、R、R、R、R、R
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...