文档详情

C语言试题选择题及答案.docx

发布:2017-04-25约1.51万字共31页下载文档
文本预览下载声明
★第1 题: 阅读程序,选择程序的运行结果___A___。 #include stdio.h main() { int x; x=try(5); printf(“%d\n”, x); } try(int n) { if(n0) return(n*try(n-2)); else return(1); }  A. 15  B. 120  C. 1  D. 前面3个答案均是错误的 第2 题: 在下列结论中,只有一个是正确的,它是___A___。  A. 递归函数中的形式参数是自动变量  B. 递归函数中的形式参数是外部变量  C. 递归函数中的形式参数是静态变量  D. 递归函数中的形式参数可以根据需要自己定义存储类型 ★第3 题: 阅读程序,选择程序的输出结果__A___。 #include stdio.h f(int x, int y) { return(y-x); } main() { int (*g)(int,int); int a=5, b=6, c=2; g=f; c=(*g)(a,b); printf(“%d\n”, c); }  A. 1  B. 2  C. 3  D. 前面3个答案均是错误的 第4 题: 阅读程序,选择程序的输出结果__D___。 #include stdio.h char *p=”abcdefghijklmnopq”; main() { while(*p++!=’e’) ; printf(“%c\n”, *p); }  A. c  B. d  C. e  D. f ★第6 题: 阅读程序,选择程序的输出结果___D___。 #include stdio.h void prtv(int *x) { printf(”%d\n”, ++*x); } main() { int a=25; prtv(a); }  A. 23  B. 24  C. 25  D. 26 第7 题: 阅读程序,选择程序的输出结果___B___。 #include stdio.h main() { static char a[ ]= ”language”, b[]=”program”; char *ptr1=a, *ptr2=b; int k; for(k=0; k7; k++) if(*(ptr1+k)==*(ptr2+k)) printf(”%c”, *(ptr1+k)); }  A. gae  B. ga  C. language  D. 有语法错误 ★第8 题: 函数调用strcat(strcpy(str1, str2), str3)的功能是__C___。  A. 将串str1复制到串str2中,然后再连接到str3之后  B. 将串str1连接到串str2之后,再复制到str3之中  C. 将串str2复制到串str1中,然后再将串str3连接到串str1之后  D. 将串str2复制到串str1中,再将串str1连接到str3之后 ★第9 题: 设有以下程序段,则在main函数中使用语句__D___是无意义的。 main() { int min(); int a, b, c, (*p)(); p=min; … } min(x, y) int x, y; { … }  A. printf(”%d\n”, min(a,b));  B. c=min(a, b);  C. c=(*p)(a,b);  D. p++; 第10 题: 已知static int a[2][3]={2,4,6,8,10,12}; 正确表示数组元素地址的是__A___。  A. *(a+1)  B. *(a[1]+2)  C. a[1]+3  D. a[0][0] 第11 题: 已知int i, x[3][4]; 则不能将x[1][1]的值赋给变量i的语句是___C___。  A. i=*(*(x+1)+1)  B. i=x[1][1]  C. i=*(*(x+1))  D. i=*(x[1]+1) ★第12 题: 当c的值不为0时,在下列选项中能够将c的值赋给变量a、b的是___C____.  A. c=b=a;  B. (a=c)||(b=c);  C. (a=c)(b=c);  D. a=c=b; 第13 题: 函数的功能是交换变量x和y中的值,且通过正确调用返回交换的结果。能正确执行此功能的函数是___D___。  A. funa(int *x, int *y) { int *p; *p=x; *x=*y; *y=*p
显示全部
相似文档