课程代码:02205
第一部分 C 语言程序设计
一、单项选择题(在每小题的四个备选答案中,选出一个正确答案,并将正确答案的序号填在题干的括号内。每小题1 分,共5 分) 1. 字符变量ch=’A’,int 类型变量k=25,语句printf(“=,Ó\n”,ch,k);输出( )。
A. 65 25 B. 65 253
C. 65,253 D. A 25
2. 数组声明“char str1[20]=″Computer″,str2[]=″World″;”,调用函数“strcat(str1,str2);”后,
字符串str1 为( )。
A. ″ComputerWorld″ B. ″Computer World″
C. ″Computer″ D. ″World″
3. 以“只读”方式打开文本文件a:\aa.dat,下列语句中哪一个是正确的( )。
A. fp=fopen(”a:\aa.dat”,”ab”)
B. fp=fopen(”a:\aa.dat”,”a”)
C. fp=fopen(”a:\aa.dat”,”wb”)
D. fp=fopen(”a:\aa.dat”,”r”)
4. 下列各个错误中,属于编译错误的是( )。
A. 数组下标超界 B. “==”误写为“!=”
C. 死循环 D. 括号不配对
5. 对语句“int a[10],*p=a;”,下列表述中哪一个是正确的( )。
A. *p 被赋初值为a 数组的首地址
B. *p 被赋初值为数组元素a[0]的地址
C. p 被赋初值为数组元素a[1]的地址
D. p 被赋初值为数组元素a[0]的地址
二、改错题(每小题2 分,共8 分) 1. #include ”stdio.h”
main()
{char a[10],b[10]=“Computer”
a=b;printf(“%s”,a);
}
2. #include ”stdio.h”
main()
{int i,s;
s=0;
for(i=0;i<=10;i++;s=s+i)
printf(“%d”,s);
}
3. #include ”stdio.h”
main()
{int a,b;
scanf(“%d,%d”a,b);
printf(“%d\t%d\n”,a,b);
}
4. #include ”stdio.h”
void fact(int k)
{
int i,s;
for(i=1;i<=k;i++)
s=s*i;
return (s);
}
【责编:daiy 纠错】
[1] [2] [3] [4]