2012年计算机等级二级C语言精讲习题及答案19

发布时间:2021-08-29 15:22:23

11、以下程序段的输出结果是(            )

#include 

mian()

{ char *ch[4]={“red”,”green”,”blue”};

Int i=0;

While(ch[i]);

{  putchar(ch[i][0]; i ;  }

}

12、 有以下程序

#include 

mian()

{int arr[]={1,3,5,7,2,4,6,8{, i, start;

Scanf(“%d”, &start);

For(i=0,i<3,i )

printf(“%d”,arr[(start i)%8]);

}

若在程序运行时输入整数10 <回车>,则输出结果为(      )。

13、 以下程序的功能是输出a数组中的所有字符串,请填空

#include 

mian()

{char *a[]={“ABC”,”DEFGH”,”IJ”,”KLMNOP”};

Int i=0;www.telnote.cn

For(;i<4;i ) printf(“%sn”,           );

}

14、以下程序的输出结果是(             )。

#include 

#include 

#include 

mian()

{ char *p, *q, *r;

p=q=r=(char *)malloc(sizeof(char)*20);

strcpy(p,”attaboy,welcome!”);

printf(“%c%c%cn”,p[11], q[3], r[4]);

free(p);

}

15、设文件test.txt中原已写入字符串Begin,执行以下程序后,文件中的内容为(            )。

#include 

mian()

{ file *fp;

 fp=fopen(“test.txt”,”w ”);www.examw.com

 fputs(“test”,fp);

 fclose(fp);

}

11、rgb       12、572   13、a[i]       14、cab   15、test

阅读更多其他试题,请访问生活日记网 用日志记录点滴生活!考试试题频道。
喜欢考试试题,那就经常来哦

该内容由生活日记网提供.