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代寫留學(xué)生Winter 18 CIS 314課程設(shè)計(jì)、R編程代寫、幫做R編程作業(yè)、R語(yǔ)言代做留學(xué)生、調(diào)試R作業(yè)、R作業(yè)調(diào)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: 轉(zhuǎn)自:http://ass.3daixie.com/2018110120083443.html
講解:Winter 18 CIS 314、R、R、R、R、R
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類: pyspark.sql...
- 函數(shù)調(diào)用 Built-in Functions abs(x) Return the absolute value ...
- 1、句子擴(kuò)寫:站在大樓頂上,他想跳下去 站在公司空曠的樓頂,樓下車來(lái)車往,人流不息,望著手機(jī)中50多個(gè)未接電話,全...