(A卷)第 5 页 共 12 页
{ char c1='A',c2='a',*p1,*p2; p1=&c1; p2=&c2;
fun(p1,p2);
printf(\ }
程序运行后的输出结果是( ) A、 Ab 16. 已定义以下函数
Fun (char *p2, char * p1)
{ while((*p2=*p1)!=' \\0'){ p1++;p2++; }} 函数Fun的功能是( )
A、将p1所指字符串复制到p2所指内存空间 B、将p1所指字符串的地址赋给指针p2 C、对p1和p2两个指针所指字符串进行比较 D、检查p1和p2两个指针所指字符串中是否有'\\0' 17. 设有以下结构体类型:
struct st { char name[8]; int num; float s[4]; }student[50];
并且结构体数组student中的元素都已有值,若要将这些元素写到硬盘文件fp中,以下不正确的形式是( ) A、 fwrite(student,sizeof(struct st),50,fp); B、 fwrite(student,50*sizeof(struct st),1,fp); C、 fwrite(student,25*sizeof(struct st),25,fp); D、 for(i =0;i<50;i++)
fwrite(student+i, sizeof(struct st),1,fp);
B、 aa
C、 Aa
D、 Bb
5
(A卷)第 6 页 共 12 页
18. 若有说明语句
char a[ ]= \char *p=\
则以下不正确的叙述是( ) A、a+1表示的是字符t的地址
B、p指向另外的字符串时,字符串的长度不受限制 C、p变量中存放的地址值可以改变 D、a中只能存放10个字符
19. 当调用函数时,实参是一个数组名,则向函数传送的是 ( )
A、 数组的长度 B、 数组的首地址
C、 数组每一个元素的地址 D、 数组每一个元素中的值
20. 设有变量说明 int a=3,b=6; char c; 若执行赋值语句 c=(a^b)<<2; 则c的二进制值是( )。 A、00011100 B、00000111 C、00000001 D、00010100
三、阅读程序,将运行结果写到各题右侧的空白处(每小题4分,共20分) 1.#include
main()
{ char str[]=\ int i;
for(i=0; i<7; i+=3) printf(\ }
6
(A卷)第 7 页 共 12 页
2.#include
for(i=0;i<3;i++) switch(i)
{ case 0: printf(\ case 2: printf(\ default: printf(\
} }
3.#include
for (i=1;i<6;i++) {
if (i%2){ printf(\ continue; } printf(\ }
printf(\ }
4.#include
7
(A卷)第 8 页 共 12 页
{
static int d=5; d+=p;
printf (\ return (d ); } main () {
int a=3;
printf(\
}
5.#include
struct stu
{ int num; char name[10]; int age;}; void py(struct stu *p) {printf(\ main() {
struct
stu
student[3]={{1001,\ py(student+2); }
四、阅读程序或程序段,填空(每小题4分,共20分)
1.下面程序的功能是调用fun函数以删除字符串中指定的字符,请填空。
void fun(char s[],int c) { int i,j;
8