}
(11)行L1输出的结果为_________。
A is B i C c is fun D没有输出 (12)行L2输出的结果为________。
A Basic B c is fun C basic D没有输出 13.阅读下面程序,回答问题。 #include
int i = 0,n = 0; char s[80],*p; p = s;
strcpy(p,”This is test!”); for(;*p!=’\\0’;p++) if(*p= =’ ’) i = 0;
else if(i= =0) {
n++; i=1; }
printf(“n=%d\\n”,n); }
该程序的功能是()。
A、统计字符串的单词个数 B、统计字符串的空格个数 C、统计字符串的字母个数 D、统计字符串全部字符个数 N14.读程序并回答问题。 #include
void fun(char *s,char *t) { char k; k = *s; *s = *t; *t = k; s++; t--;
if(*s) fun(s,t); }
void main()
{ char str[10] = \ p = str + strlen(str)/2+1; fun(p,p-2);
printf(\}
程序的运行结果为( )。 A、abcdefg B、defgabc C、acegbdf D、gfedcba 15.读程序,回答问题。 #include
void main(int argc,char *argv[] ) {
int i=1,n=0; while(i n = n+strlen(argv[i]); i++; } printf(“%d\\n”,n); } 若该程序生成的可执行文件名为2-4.exe,运行时输入命令行: 2-4 123 45 67 则程序的运行结果是( )。 A、3 B、5 C、7 D、11 16.读程序,回答问题。 下面程序的输出是 # include main() { int m=3,n=6; test(&m,n); printf(\输出结果1 test(&n,m); printf(\输出结果2 } 输出结果1是: (A)9 6 (B)6 9 (C)3 6 (D)6 3 17.若有以下定义和语句,则值为12的表达式是_________。 struct wc{ int a;int *b;}*p; int x0[]={11,12},x1[]={31,32}; static struct wc x[2]={100,x0,300,x1}; p=x; A) *++p->b B) ++p->a C) p->b D) *(p++)->b 18. 以下程序的运行结果是______ void main() { int flag=1; char ch; do{ ch=getchar(); flag=chang(&ch,flag); putchar(ch); }while(ch!='\\n'); } chang(char *c, int fg) { if(*c==' ') return 1; else if( fg && *c<='z'&&*c>='a') *c+='A'-'a'; return 0; } 程序运行时,从第一列开始输入以下字符, A) This is a book! B) this Is A Book! C) This Is A Book! D) This Is a Book! 19. 读下列程序: void main() { static char str[50]=\ int sum1 = 0,sum2=0; while(*p!='\\0') { if(*p>=48&&*p<=57) sum1++; else if(*p>=101&&*p<=107) sum2++; else; p++; } printf(\} 程序的运行结果是______ A) 3,2 B) 2,3 C) 3,12 D) 12,3 R20、下面程序输出数组中的最大值,由s指针指向该元素。 main() { int a[10]={6,7,2,9,1,10,5,8,4,3},*p,*s; for(p=a,s=a;p-a<10;p++) if( ) s=p; printf(“The max:%d”,*s); } 则在if语句中的判断表达式应是( ) A、p>s B、*p>*s C、a[p]>a[s] D、p-a>p-s N21、下列程序: int *f(int *px, int *py) { return *px>*pypx:py; } void main() { int a=2, b=3, c=9; *f(&a,&b) = c; printf(\} 执行后的结果是: A) 10 B)5 C) 9 D)程序有错,不能运行 22(1)下面程序的输出是 # include main() { int m=3,n=6; test(&m,n); printf(\输出结果1 test(&n,m); printf(\输出结果2 } 输出结果1是: (A)9 6 (B)6 9 (C)3 6 输出结果2是: D)6 3 (
相关推荐: