S(t)=∫083t2dt
S(t)=ds/dt+t2
S(t)=t3+3t
S(t)= t2+2t
第1题:
设R(t)表示可靠度函数,F(t)表示累积故障分布函数,则以下描述正确的是( )。
A.R(t)是[0,∞)区间内的非减函数,且0≤R(t)≤1
B.R(t)是[0,∞]区间内的非增函数,且0≤R(t)≤l
C.在(0,∞)区间内,R(t)+F(t)=l
D.F(t)在[0,∞]区间内的非减函数,且0≤F(t)≤1
E.F(t)在[0,∞]区间内的非增函数
第2题:
●试题二
阅读下列程序或函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。
【函数2.1说明】
函数strcmp()是比较两个字符串s和t的大小。若s<t函数返回负数;若s=t函数返回0;若s>t,函数返回正数。
【函数2.1】
int strcmp(char *s,char *t)
{ while(*s && *t && (1) ){
s++;t++;
}
return (2) ;
}
【程序2.2说明】
在n行n列的矩阵中,每行都有最大的数,本程序求这n个最大数中的最小一个。
【程序2.2】
#includestdio.h
#define N 100
int a[N][N];
void main()
{ int row ,col,max,min,n;
/*输入合法n(<100),和输入n×n个整数到数组a的代码略*/
for (row=0;row<n;row++){
for(max=a[row][0],col=1;col<n;col++)
if( (3) )max=a[row][col];
if( (4) )min=max;
else if( (5) )min=max;
}
printf ("The min of max numbers is %d\n",min);
}
●试题二
【答案】(1)*s == *t(2) *s - *t
【解析】*s 和 *t相等才执行循环体。返回二者差值,恰好符合题目要求。
【答案】(3) a[row][col]>max (4) row == 0(5) max<min
【解析】当前值比max大,则把它赋给max。max是本行最大值。初始化min为第一行的max。该行的max比min小,则将max赋给min。
第3题:
A.strcmp1(char *s, chat *t)
{ for ( ;*s++==*t++ ;)
if (*s=='\0') return 0
return (*s-*t)
}
B.strcmp2(char *s, char *t)
{ for( ;*s++==*t++ ;)
if (!*s) return0
return (*s-*t)
C.strcmp3(char *s, char *t)
{ for ( ;*t==*s ;)
{ if (!*t) return 0
t++
s++}
return (*s-*t)
}
D.strcmp4(char *s, char *t)
{ for( ;*s==*t;s++,t++)
if (!*s) return 0
return (*t-*s)
}
第4题:
设R(t)表示可靠度函数,F(t)表示累积故障分布函数,则下列表述正确的有( )。
A.R(t)是[0,∞)区间内的非减函数,且0≤R(t)≤1
B.R(t)是[0,∞)区间内的非增函数,且0≤R(t)≤1
C.在[0,∞)区间内,R(t)+F(t)=1
D.F(t)在[0,∞)区间内的非减函数,且0≤F(t)≤1
E.F(t)在[0,∞)区间内是非增函数
第5题:
[说明1]
函数void convelt(chal *a,int n)是用递归方法将一个正整数n按逆序存放到一个字符数组a中,例如,n=123,在a中的存放为'3'、'2'、'1'。
[C函数1]
void convert(char *a,int n)
{ int i;
if((i=n/10)!=0; convert( (1) ,i);
*a= (2) ;
}
[说明2]
函数int index(char *s,char *t)检查字符串s中是否包含字符串t,若包含,则返回t在s中的开始位置(下标值),否则返回-1。
[C函数2]
int index(char *s,char *t)
{ int i,j=0;k=0;
for(i=0;s[i]!:'\0';i++)
( for( (3) ;(t[k]!='\0')&&(s[j]!='\0')&&( (4) );j++,k++);
if( (5) ) return(i);
}
return(-1);
}
第6题:
函数sstrcmp()的功能是对两个字符串进行比较。当s所指字符串和t所指字符串相等时,返回值为0;当s所指字符串大于t所指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于0(功能等同于库函数strcmp()),请填空。#include<stdio.h>int sstrcmp(char *s,char *t){ while(*s&&*t&&*s= =){s++;t++; }return;}
第7题:
函数int factors(int n)的功能是判断整数n(n>=2)是否为完全数。如果n是完全数,则函数返回0,否则返回-1。
所谓“完全数”是指整数n的所有因子(不包括n)之和等于n自身。例如,28的因子为1,2,4,7,14,而28=1+2+4+7+14,因此28是“完全数”。
[C函数1]
int factors(int n)
{ int i,s;
for(i=1,s=0;i<=n/2;i++)
if(n%i=0) (1)______;
if( (2)______ )return 0;
rerurn-1;
}
[说明2]
函数int maxint(int a[],int k)的功能是用递归方法求指定数组中前k个元素的最大值,并作为函数值返回。
[C函数2]
int maxint(int a[],int k)
{ int t;
if( (3)_____ ) return (4)_______;
t=maxint(a+1, (5)______ );
return(a[0]>t)?a[0]:t;
}
第8题:
函数my_cmp()的功能是比较字符串s和t的大小,当s等于t时返回0,否则返回s和t的第一个不同字符的ASCII码差值,即s > t时返回正值,当s < t时返回负值。请填空。
my_cmp(char *s, char *t)
{while (*s == *t)
{if (*s == ′\0′)return 0;
++s; ++t;
} return 【18】 ;
}
第9题:
( 8 )已知有函数 f 的定义如下:
int f(){
static int s=0;
s+=2;
return s;
}
则在某程序中第 2 次执行函数调用语句 f( ) ; 时 , 函数 f 的返回值是 ___________ 。
第10题:
阅读以下说明和C语言函数,将应填入(n)处的语句写在对应栏内。
【说明】
设串s和串t采用顺序存储结构,编写函数实现串s和串t的比较操作,要求比较结果包括大于、小于和等于3种情况。
【函数】
int StrCompare(SStrType s, SStrType t)
{
int n=s.length, m=(1), i,j,tag;
i=0; j=0;
while((2))
{
if((3))
{
i++;
j++;
}
else if(s.str[i]>t.str[j])
{
tag=1;
return tag;
}
else
{
tag=-1;
return tag;
}
}
if(n==m)
tag=0;
else if((4))
tag=1;
else if(n<m)
tag=-1;
(5);
}