以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; for(i=0;i<4;i++)strcpy(x[i],ch); for(i=0;i<4;i++)printf("%s",&x[i][i]); printf("\n"); }
第1题:
以下程序段的输出结果是 ______。 #include<iostream.h> void main(){ char*p[5]={"ABCD","EF","GHI","JKL","MNOP"}; char **q=p; int i; for(i=0;i<=4;i++) cout<<q[i]; }
A.ABCDEFGHIJKL
B.ABCD
C.ABCDEFGHIJKMNOP
D.AEGJM
第2题:
有以下程序: int fa(int x) { return x *x;} int fb(int x) { return x *x *x;} int f(int( *f1)( ),int( *f2)( ),int x) { return f2(x)-f1(x);} main( ) { int i; i=f(fa,fb,2);printf("%d\n",i); } 程序运行后的输出结果是
A.-4
B.1
C.4
D.8
第3题:
以下程序运行后的输出结果是() 。 #include <stdio.h> #include <stdlib.h> #include <string.h> main() { char *p; int i; p=(char *)malloc(sizeof(char)*20); strcpy(p,"welcome"); for(i=6;i>=0;i--) putchar(*(p+i)); printf("n"); free(p); }
第4题:
有以下程序: int fa(int x) { return x*x; } int fb(int x) { return x*x*x; } int f(int (*f1)(),int (* f2)(),int x) { return (*f2)(x)-(*f1)(x); } main() { int i; i=f(fa,fb,2); printf("%d\n",i); } 程序运行后的输出结果是( )
A.-4
B.1
C.4
D.8
第5题:
有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。
A.2
B.3
C.4
D.5