C语言试题选择题及答案 下载本文

内容发布更新时间 : 2024/7/7 1:51:01星期一 下面是文章的全部内容请认真阅读。

. ★第1 题:

阅读程序,选择程序的运行结果___A___。 #include main() { int x; x=try(5);

printf(“%d\\n”, x); }

try(int n)

{ if(n>0) 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 f(int x, int y) { return(y-x); } main()

{ int (*g)(int,int);

int a=5, b=6, c=2;

1 / 31

. g=f;

c=(*g)(a,b);

printf(“%d\\n”, c); }

A. 1 B. 2 C. 3

D. 前面3个答案均是错误的

第4 题:

阅读程序,选择程序的输出结果__D___。 #include

char *p=”abcdefghijklmnopq”; main()

{ while(*p++!=’e’) ; printf(“%c\\n”, *p); } A. c B. d C. e D. f

★第6 题:

阅读程序,选择程序的输出结果___D___。 #include void prtv(int *x)

{ printf(”%d\\n”, ++*x); } main()

{ int a=25; prtv(&a); }

A. 23

2 / 31

. B. 24 C. 25 D. 26

第7 题:

阅读程序,选择程序的输出结果___B___。 #include main()

{ static char a[ ]= ”language”, b[]=”program”; char *ptr1=a, *ptr2=b; int k;

for(k=0; k<7; 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();

3 / 31