复旦计算机原理,复旦计算机春季期末考试试题A.doc

复旦计算机春季期末考试试题A

复旦大学计算机科学技术学院

《计算机原理》期末考试试卷

A卷 共 13页

课程代码:INFO130054.01-02 _考试形式:开卷 2010年6月

(本试卷答卷时间为100分钟,答案必须写在答卷上,做在试卷上无效)

专业学号姓名成绩

题号1234567总分得分

Number Conversion: IEEE 754 single precision 32-bit float standard representation with a little change is illustrated below.

Normalized: (-1)sign * (1.fraction) * 2exponent-127 (exp=1 to 254)

Denormalized: (-1)sign * (0.fraction) * 2-126(when exp=0, fraction≠0)

Zero: all 0’s in all 3 fields

Convert the number -35.390625 into this changed IEEE 754 FP single precision representation (in hex).

(-35.390625)10 = (0x )16

With changed 32-bit float representation, what is the equivalent value as a decimal number?

A: (0011 1111 0001 0000 0000 0000 0000 0000)2

B: (0000 0000 0011 0101 0000 0000 0000 0000)2

Calculate the sum of (35.390625)10 and (0011 1111 0001 0000 0000 0000 0000 0000)2 using changed 32-bit float representation, and then round the sum (in binary number value, e.g. (1000.11)2 for (8.75)10 ) to 4 bits to the right of the binary point by both round-up and round-down. Give your steps detailed.

Given three numbers f1, f2 and f3 of this changed 32-bit representation, none of them equals +(, -( or NaN, and x is signed 32-complement representation. Please tell whether two C expressions below are always true. If yes, give the reason in detail; If no, give a counterexample and show the detail computation steps to get false.

A: x = = (int) (float) x;

B: (f1 > f2) = = ((f1 + f3) > (f2 + f3))

Please read the following C code and assembly code and then fill in the blanks.

#include

int p[5][4] = {{43,56,78,69},{-7,89,7,23},{24,36,88,67},

{12,56,78,90},{62,93,-78,9}};

int main(void){

int result = cal(5,4);

printf("The result is %d\n", result);

}

int cal(int a, int b){

int i;

int result=0;

for ( i = 0; i < b; i++) {

if (i < a-1)

result -= i*p[i+1][i];

}

return result;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值