A、soon
B、since
C、after
D、before
第1题:
请阅读下面程序 public class ThreadTest{ public static void main(String args[])throws Ex- ception{ int i=0; Hello t=new Hello; ; while(true){ System.Out.println("Good Morning"+i++): if(i= =2t.isAlive){ System.out.println("Main waiting for Hel- lo!"); join;//等待t运行结束 } if(i= =5)break;} } } class Hello extends Thread{ int l; public void run{ while(true)( System.Out.println("Hell0"+i++); if(i= =5)break;)))
A.t.sleep
B.t.yield
C.t.interrupt
D.t.start
第2题:
若程序中已包含头文件stdio.h,以下选项中,正确运用指针变量的程序段是 ______。
A.int*i=NULL; scanf("%d",i);
B.float * f=NULL *f=19.5;
C.char t='m',*c=&t; *c=&t;
D.long *L; L='\0';
第3题:
下列程序段的输出结果是【 】。
public class Test {
void printValue(int m) {
do {
System.out.println("The value is"+m);
}while (--m>10);
}
public static void main (String args[]) {
int i=10;
Test t= new Test();
t.printValue(i);
}
}
第4题:
第5题:
以下选项中,正确运用指针变量的程序段是( )。
A.int*i=NULL;
B.float*f=NULL; scanf("%d",i); *f=10.5;
C.char t='m',*C=&t;
D.long*L; *C=&t; L='0';
第6题:
编写函数,isValue,它的功能是:求以下数列中满足t(K)=1的最小的k,结果由函数返回。其中数列t(n)的定义为:
t(0)=m(m为给定正整数,m<=300)
t(n+1)=t(n)/2 (当t(n)为偶数时)
或t(n+1)=3*t(n)+1(当t(n)为奇数时)
最后调用函数writeDat()读取50个数据m,分别得出结果且把结果输出到文件out.dar中。
例如:当t=299时,函数值为117。
已知对于m<=300,结果k不超过300
部分源程序已给出。
请勿改动主函数main()和写函数writeDat()的内容。
include<stdio. h>
int jsValue(int m)
{
main ( )
{
int m;
m=300;
printf ("m=%d, k-%d\n", m, jsValue (m));
writeDat ( );
writeDat ( )
{
FILE *in, *out;
int i,m,s;
in= fopen ( "in. dar" , "r" );
ut=f open ( "out. dar" , "w" );
for (i=0; i<50; i++) {
fscanf (in, "%d", &m);
s=jsValue (m);
printf( "%d\n", s );
fprintf (out, "%d\n" , s );
}
fclose (in);
fclose (out);
第7题:
若程序中已包含头文件stdio.h,以下选项中,正确运用指针变量的程序段是
A.int *i=NULL; scanf("%d",i;
B.float *f=NULL; *f=10.5;
C.char t='m',*c=&t; *c=&t;
D.long *L; L='\0';
第8题:
学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun(),该函数的功能是:把高于等于平均分的学生数据放在b所指的数组中,低于平均分的学生数据放在c所指的数组中,高于等于平均分的学生人数通过形参n传回,低于平均分的学生人数通过形参m传回,平均分通过函数值返回。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <stdio.h>
define N 12
typedef struct
{char num[10];
double S;
} STREC;
double fun(STREC *a,STREC *b,STREC *C,int *n,int *m)
{
}
main()
{
STREC s[N]={{“GA05”,65},{“GA03”,86},
{“GA02”,76},{“GA04”,95},{“GA01”,93},
{“GA07”,78},{“GA08”,68},{“GA06”,88},
{“GA09”,60},{“GAll”,54},{“GAl2”,56},
{“GAl0”,98}};
STREC h[N],l[N],t;
FILE *out;
int i,j,m,n;
double ave;
ave=fun(S,h,l,&n,&m);
printf("The %d student data which is higher than %7.3f:\n",n,ave);
for(i=0;i<n;i++)
printf("%s %4.lf\n",h[i].num,
h[i].s);
printf("\n");
printf("The %d Student data which iS lower than%7.3f:\n",m,ave);
for(i=0;i<m;i++)
printf("%s %4.1f\n",l[i].num, l[i].s);
printf("\n");
ut=fopen("out26.dat", "w");
fprintf(out, "%d\n %7.3f\n",n,ave);
for(i=0;i<n-1;i++)
for(j=i+1;i<n;j++)
if(h[i].s<h[j].s)
{t=h[i];h[i]=h[i];h[j]=t;}
/*分数从现到低排列*/
for(i=0;i<n; i++)
fprintf(out,“%4.1f\n",h[i].s);
fprintf(out,"%d\n %7.3f\n",m,ave);
for(i=0;i<m-1;i++)
for(j=i+1;i<m;j++)
if(l[i].s<l[j].s)
{t=l[i];l[i]=l[j];l[j]=t;}
/*分数从高到低排列*/
for(i=0;i<m;i++)
fprintf(out,"%4.1f\n",l[i].s);
fclose(out);
}
第9题:
若程序中已包含头文件stdio.h,以下选项中,正确运用指针变量的程序段是
A.int *i = NULL; scanf("%d", i);
B.float *f = NULL; *f = 10.5;
C.char t = 'm', *c = &t; *c = &t;
D.long *L; L = '\0';
第10题: