超星尔雅学习通第6次答案章节单元测试期末考试网课答案

超星尔雅学习通第6次答案章节单元测试期末考试网课答案

第6次 "

设有说明int(*ptr)[M];,其中的标识符ptr是______。[]

" "

以下程序的输出结果为______。main(){char *alpha[6]={""ABCD"",""EFGH"",""IJKL"",""MNOP"",""QRST"",""UVWX""};char **p;int i;p=alpha;for(i=0;i4;i++)printf(""%s"",p[i]);printf(""\n"");}[]

" "

下列程序的输出结果是______。main(){char a[10]={9,8,7,6,5,4,3,2,1,0},*p=a+5;printf(""%d"",*--p);}[]

" "

有以下程序#include stdio.hint *fun(){static int a[2] = {0, 1};a[0]+=a[1];a[1]+=a[0];return a;}void main(){int i,*b;for (i=1;i5;i++){b=fun();printf(""%d %d "",b[0], b[1]);}printf (""\n"");}程序的运行结果是______。[]

" "

以下针对相应语句的注释中,说法错误的是______。[]

" "

有以下程序#include stdio.hmain(){int a[10] = { 11,12,13,14,15,16,17,18,19,20 },*p=a,i=9 ;printf( ""%d,%d,%d\n"",a[p-a], p[i],*(a[i]));}程序运行后的输出结果是______。[]

" "

有如下说明:int a[10] = {1,2,3,4,5,6,7,8,9,10},*p = a;则数值为9的表达式是______。[]

" "

有以下程序#include stdio.hvoid exch(int t[]){t[0]=t[5];}main(){int x[10]={1,2,3,4,5,6,7,8,9,10},i=0;while(i=4){exch(x[i]);i++;}for(i=0;i5;i++) printf(""%d"",x[i]);printf(""\n"");}程序运行后输出的结果是______。[]

" "

有以下程序______。#include stdio.hvoid fun(int *p){printf(""%d\n"",p[5]);}main(){int a[10]={1,2,3,4,5,6,7,8,9,10};fun(a[3]);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a, int b){int t;t=a;a=b;b=t;}main(){int c[10]={1,2,3,4,5,6,7,8,9,0}, i;for(i=0;i10;i+=2)fun(c[i],c[i+1]);for(i=0;i10;i++)printf(""%d,"",c[i]);printf(""\n"");}程序的运行结果是______。[]

" "

以下程序中函数f的功能是:当flag为1时,进行由小到大排序;当flag为0时,进行由大到小排序。void f (int b[],int n,int flag){int i,j,t;for(i=0;in-1;i++)for(j=i+1;jn;j++)if(flag?b[i]b[j]:b[i]b[j]){t=b[i]; b[i]=b[j]; b[j]=t;}}main(){int a[10]={5,4,3,2,1,6,7,8,9,10}, i;f(a[2],5,0);f(a,5,1);for(i=0;i10;i++)printf(""%d,"",a[i]);}程序运行后的输出结果是______。[]

" "

有以下程序void sum(int a[]){a[0]=a[-1]+a[1];}main(){int a[10]={ 1,2,3,4,5,6,7,8,9,10};sum(a[2]);printf(""%d\n"",a[2]);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(char **p){++p;printf(""%s\n"",*p);}main(){char *a[]={""Morning"",""Afternoon"",""Evening"",""Night""};fun(a);}程序运行的结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int *x,int s,int e){int i,j,t;for(i=s,j=e; ij; i++,j--){t=*(x+i);*(x+i)=*(x+j);*(x+j)=t;}}main(){int m[]={0,1,2,3,4,5,6,7,8,9},k;fun(m,0,3);fun(m+4,0,5);fun(m,0,9);for(k=0;k10;k++)printf(""%d"",m[k]);}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid fun(char *t,char *s){while(*t!=0 )t++;while((*t++=*s++)!=0);}main(){char ss[10]= ""acc"",aa[10]= ""bbxxyy"";fun(ss,aa);printf(""%s,%s\n"",ss,aa);}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a[ ], int n){int i,j=0,k=n-1, b[10];for (i=0; in/2; i++){b[i]=a[j];b[k]=a[j+1];j+=2;k--;}for (i=0; in;i++)a[i] = b[i];}main(){int c[10]={10,9,8,7,6,5,4,3,2,1},i;fun(c, 10);for (i=0;i10;i++)printf(""%d,"", c[i]);printf(""\n"");}程序的运行结果是______。[]

" "

有以下程序void fun(int *a,int i,int j){int t;if(ij){t=a[i];a[i]=a[j];a[j]=t;i++; j--;fun(a,i,j);}}main(){int x[]={2,6,1,8},i;fun(x,0,3);for(i=0;i4;i++)printf(""%2d"",x[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int *s,int n1,int n2){int i,j,t;i=n1;j=n2;while(ij){t=s[i];s[i]=s[j];s[j]=t;i++;j--;}}main(){int a[10]={1,2,3,4,5,6,7,8,9,0},k;fun(a,0,3);fun(a,4,9);fun(a,0,9);for(k=0;k10;k++)printf(""%d"",a[k]);printf(""\n"");}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a[ ], int n){int i,j=0,k=n/2, b[10];for (i=n/2-1; i=0; i--){b[i] =a[j];b[k] =a[j+1];j+=2; k++;}for (i=0; in; i++)a[i] = b[i];}main(){int c[10]={10,9,8,7,6,5,4,3,2,1},i ;fun(c, 10);for (i=0;i10; i++)printf(""%d,"", c[i]);printf(""\n"");}程序的运行结果是______。[]

" "

有以下程序#include stdio.h#include string.hvoid fun(char *s[],int n){char *t;int i,j;for(i=0;in-1;i++)for(j=i+1;jn;j++)if(strlen(s[i])strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;}}main(){char *ss[]={""bcc"",""bbcc"",""xy"",""aaaacc"",""aabcc""};fun(ss,5);printf(""%s,%s\n"",ss[0],ss[4]);}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a[ ], int n){int i;for (i=0;in;i++){if (i % 3 == 0)a[i] -= n;else a[i] += n;}}main(){int c[5] = {6,7,8,9,10},i;fun(c, 5);for (i=0;i5;i++)printf(""%d,"", c[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int *s,int t,int *k){int p;for(p=0, *k=p; pt; p++ )if( s[p]s[*k] ) *k = p;}main(){int a[10] = { 11,12,13,14,15,16,20,18,19,10 },k ;fun( a,10,k );printf( ""%d,%d\n"",k, a[k] );}程序运行后的输出结果是______。[]

" "

若有以下程序#include stdio.hvoid fun(int a[ ], int n){int t, i, j;for ( i=0; in; i+=2 )for ( j=i+2; jn; j+=2 )if ( a[i] a[j] ){t=a[i]; a[i]=a[j]; a[j]=t;}}main(){int c[10]={10,9,8,7,6,5,4,3,2,1},i;fun(c, 10);for ( i=0; i10; i++ )printf(""%d,"", c[i]);printf(""\n"");}则程序的输出结果是______。[]

" "

有如下程序#include stdio.hint sum(int* array, int len){if (len == 0)return array[0];elsereturn array[0] + sum(array+1, len-1);}main(){int array[5] = {1,2,3,4,5};int res = sum(array, 4);printf(""%d\n"", res);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid f (int b[]){int i;for(i=2;i6;i++)b[i]*=2;}main(){int a[10]={1,2,3,4,5,6,7,8,9,10},i;f(a);for(i=0;i10;i++)printf(""%d,"",a[i]);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun( int a[ ], int n, int flag ){int i=0,j,t;for ( i=0; in-1; i++ )for ( j=i+1; jn; j++ )if( flag ){if( a[i]a[j] ){ t=a[i]; a[i]=a[j]; a[j]=t;}}else{if( a[i]a[j] ){ t=a[i]; a[i]=a[j]; a[j]=t; }}}main(){int c[10]={ 7,9,10,8,3,5,1,6,2,4 },i;fun( c, 4, 1 );fun( c+4, 6, 0 );for ( i=0;i10;i++ )printf( ""%d,"",c[i] );printf(""\n"");}程序运行后的输出结果是______。[]

" "

有以下程序,程序中库函数islower(ch)用以判断ch中的字母是否为小写字母#include stdio.h#include ctype.hvoid fun(char *p ){int i=0;while(p[i]){ if(p[i]==' 'islower(p[i-1]))p[i-1]=p[i-1]-'a'+'A';i++;}}main(){char s1[100]=""ab cd EFG !"";fun(s1);printf(""%s\n"",s1);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hint fun(int x[],int n){static int sum=0, i;for(i=0;in;i++) sum+=x[i];return sum;}main(){int a[]={1,2,3,4,5}, b[]={6,7,8,9}, s=0;s=fun(a,5)+fun(b,4);printf(""%d\n"",s);}程序执行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int *x,int s,int n){int i;for(i=s;i=n;i--)*(x+i+3)= *(x+i);}main(){int m[]={0,1,2,3,4,5,6,7,8,9},k;fun(m,10-4,3);for(k=0;k10;k++)printf(""%d"",m[k]);}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid f(int *q){int i=0;for( ;i5;i++) (*q)++;}main(){int a[5]={1,2,3,4,5},i;f(a);for(i=0;i5;i++)printf(""%d,"",a[i]);}程序运行后的输出结果是______。[]

" "

有以下程序(函数fun只对下标为偶数的元素进行操作)#include stdio.hvoid fun(int *a,int n){int i,j,k,t;for(i=0;in-1;i+=2 ){k=i;for(j=i;jn;j+=2)if(a[j]a[k]) k=j;t=a[i]; a[i]=a[k]; a[k]=t;}}main(){int aa[10]={1,2,3,4,5,6,7},i;fun(aa,7);for(i=0;i7;i++)printf(""%d,"",aa[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

若有以下程序#include stdio.hvoid fun(int a[ ], int n){int t,i,j;for (i=1; in; i+=2)for (j=i+2; jn; j+=2)if (a[i]a[j]){ t=a[i]; a[i]=a[j];a[j]=t;}}main(){int c[10]={10,9,8,7,6,5,4,3,2,1},i;fun(c, 10);for (i=0;i10; i++)printf(""%d,"", c[i]);printf(""\n"");}则程序的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a[],int n){int i,t;for(i=0;in/2;i++){t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;}}main(){int k[10]={1,2,3,4,5,6,7,8,9,10},i;fun(k,5);for(i=2;i8;i++)printf(""%d"",k[i]);printf(""\n"");}程序的运行结果是______。[]

" "

以下程序的主函数中调用了在其前面定义的fun函数#include stdio.hmain(){double a[15],k;k=fun(a);}则以下选项中错误的fun函数首部是______。[]

" "

有如下程序#include stdio.hvoid change(int* array, int len){for (; len=0; len--)array[len] -= 1;}main(){int i, array[5] = {2,2};change(array, 4);for (i=0; i5; i++)printf(""%d,"", array[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

当调用函数时,实参是一个数组名,则向函数传送的是______。[]

" "

有以下程序#include stdio.hint fun(int a[],int n,int x){int *p=a;while( pa+n *p!=x ) p++;if( pa+n )return p-a;else return -1;}main(){int a[10]={1,2,3,4,5,6,7,8,9,10};printf(""%d\n"",fun(a,10,10));}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid fun(int a[], int n){int i=0;for (i=0;in;i++){if (i % 2 == 0)a[i] += n;else a[i] -= n;}}main(){int c[5] = {5,4,3,2,1}, i;fun(c, 5);for (i=0;i5;i++)printf(""%d,"", c[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

有如下程序#include stdio.hvoid change(int* array, int len){for (; len=0; len--)array[len] += 2;}main(){int i, array[5] = {1,2};change(array, 4);for(i=0;i4;i++)printf(""%d,"", array[i]);printf(""\n"");}程序运行后的输出结果是______。[]

" "

以下程序调用fun函数求数组中最大值所在元素的下标。#include stdio.hvoid fun(int *s,int n,int *k ){int i;for( i=0 ,*k=i;in;i++ )if( s[i] s[*k] )______;}main(){int a[5]={1,6,2,8,0}, k;fun(a,5,k );printf(""%d %d\n"", k, a[k] );}在横线处应填入的内容是______。[]

" "

有以下程序#include stdio.hint fun( int *b,int n){int i, r=1;for( i=0;i=n;i++ )r=r*b[i];return r;}main(){int x, a[]={2,3,4,5,6,7,8,9};x=fun( a,3);printf(""%d\n"",x);}程序运行后的输出结果是______。[]

" "

有以下程序#include stdio.hint fun(char s[]){int n=0;while(*s='9'*s='0'){n=10*n+*s-'0';s++;}return(n);}main(){char s[10]={ '6','1','*','4','*','9','*','0','*'};printf(""%d\n"",fun(s));}程序的运行结果是______。[]

" "

有以下程序#include stdio.hvoid change(int k[]){ k[0]=k[5]; }main(){int x[10]={1,2,3,4,5,6,7,8,9,10}, n=0;while(n=4){change(x[n]); n++;}for(n=0;n5;n++)printf(""%d "",x[n]);printf(""\n"");}程序运行后输出的结果是______。[]

" "

有以下程序:#include stdio.hvoid sum(int *a){a[0]=a[1];}main(){int aa[10]={1,2,3,4,5,6,7,8,9,10},i;for(i=2;i=0;i--) sum(aa[i]);printf(""%d\n"",aa[0]);}执行后的输出结果是______。[]

" "

有以下程序#include stdio.hvoid swap1(int c0[],int c1[]){int t;t=c0[0];c0[0]=c1[0];c1[0]=t;}void swap2(int *c0,int *c1){int t;t=*c0;*c0=*c1;*c1=t;}main(){int a[2]={3,5},b[2]={3,5};swap1(a,a+1);swap2(b[0],b[1]);printf(""%d %d %d %d\n"",a[0],a[1],b[0],b[1]);}程序运行后的输出结果是______。[]

" "

有下列程序#include stdio.hvoid main(){int arry[][3] = {{1,3},{5},{7,9}},i,j;for(i=2;i=0;i--){for(j=2;j=0;j--)printf (""%d "",arry[i][j]);}}程序执行后的输出结果是______。[]

" "

以下程序的输出结果是______。#include stdio.hmain(){char w[][10]={""ABCD"",""EFGH"",""IJKL"",""MNOP""},k;for(k=1;k3;k++)printf(""%s"",w[k]);}[]

" "

以下程序的输出结果是______。#include stdio.hmain(){char ch[3][5]={""AAAA"",""BBB"",""CC""};printf(""%s\n"",ch[1]);}[]

" "

有以下程序#include stdio.hmain(){int i,t[][3]={9,8,7,6,5,4,3,2,1};for(i=0;i3;i++)printf(""%d "",t[2-i][i]);}程序执行后的输出结果是______。[]

" "

若有定义:int w[3][5];,则以下不能正确表示该数组元素的表达方式是______。[]

" "

有以下程序#include stdio.hmain(){int i, k;int array[4][2] = {{1,0}, {0}, {2,9}, {3;for (i=0; i2; i++)for (k=0; k3; k++){printf(""%d,"", array[k][i]);}printf(""\n"");}程序运行后的输出结果是______。[]

"

超星尔雅学习通第6次答案章节单元测试期末考试网课答案

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处: