此题为判断题(对,错)。
第1题:
阅读以下说明和C程序,将应填入(n)处。
[说明]
某种传感器的输出值Ratio依赖于环境温度temp(-40℃≤temp≤50℃)。对一组环境温度值(ITEMS个),人们已经测量得到了相应的Ratio值(见表1)。该表粗略地描述了曲线Ratio(temp)。
校正系数K是Ratio的倒数,因此也依赖于环境温度temp。在数据处理中,人们需要用更多的列表值细致地描述曲线K(temp),如表2所示。在表2中,各温度值所对应的K值是对表1进行线性插值再求倒数得到的,具体的计算方法如下:
1.根据temp值,在表1中用二分法查找;
2.若找到相应的温度值,则按相应的Ratio值求倒数得到K值:
3.若没找到相应的温度值,则可确定temp所在的温度区间[Tp1, Tp2],同时获得了相应的Ratio1和Ratio2,再按如下公式计算K值:
Step=(Ratlo1-Ratio2)/(Tp1-Tp2)
K=1.0/(Ratio1+Step*(temp-Tp1))
在程序中,当temp高于50℃或低于-40℃时,设定K=0。
[程序]
include <stdio.h>
typedef struct {
int Temp; /*环境温度*/
double Ratio; /*传感器的输出值*/
}CURVE;
define ITEMS 7
double GetK(int, CURVE*, int);
void main()
{
int Degree;
double k;
CURVE Curve[ITEMS]={ {-40,0.2},{-20,0.60},{-10,0.8},{0,1,0},
{10,1.17},{30,1.50}, {50,1.8} };
printf("环境温度 校正系数\n");
for( Degree= 40; Degree<=50; Degree++){
k=GetK(Degree, Curve, ITEMS);
printf(" %3d %4.2f\n",Degree,k);
}
}
double GetK(int Temp, CURVE *p, int n)
{/*用二分法在n个元素的有序表p中查找与Temp对应的传感器输出值*/
int low,high,m; double Step;
low=0; high=n-1;
if((Temp<p->Temp) ||( Temp>(p+high)->Temp))
return 0.0; /*超出温度范围时返回0.0*/
while (low<=high){
m=(1) ;
if(Temp==(p+m)->Temp)
return (2);
if (Temp<(p+m)->Temp)high=m-1;
else low=(3);
}
p+= high;
Step=((4))/((p+1)->Temp-p->Temp);
return 1.0/(p->Ratio +Step *((5)));
}
第2题:
12. About_______ of the workers in the factory were born in the __________.
A. two- thirds;1970
B. two- thirds ; 1970s
C. two-third ; 1970
D. two-third ; 1970s
第3题:
RATIO压缩比选择用来确定超过阈值的信号的噪声比。
第4题:
About ________ of the workers in the factory were born in the ________.
A.two-thirds, 1970 B.two-thirds, 1970s C.two-third,1970 D.two-third, 1970s
第5题:
定量数据可以进一步划分为4中类型,不包括以下哪一种?
A.标称型(Nominal)
B.文本型(Textual)
C.顺序型(Ordinal)
D.比值型(Ratio)
第6题:
下列Moore型状态机采用Verilog语言主控时序部分正确的是:
A.always@(posedge clk or negedge reset) begin if(!reset) current_state<=s0; else current_state<=next_state; end
B.always@(posedge clk ) begin if(!reset) current_state<=s0; else current_state<=next_state; end
C.always@(posedge clk t) if(reset) current_state<=s0; else current_state<=next_state;
D.always@(posedge clk or negedge reset) if(reset) current_state<=s0; else current_state<=next_state;