就业数据资源平台
当前位置:首页 > C语言程序设计
2012年计算机等级二级C语言精讲习题及答案19


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


#include <sthio.h>


mian()


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


Int i=0;


While(ch[i]);


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


}



12、 有以下程序


#include <sthio.h>


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 <sthio.h>


mian()


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


Int i=0;www.Examw.com


For(;i<4;i++) printf(“%s\n”,           );


}



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


#include <sthio.h>


#include <sthio.h>


#include <string.h>


mian()


{ char *p, *q, *r;


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


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


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


free(p);


}



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


#include <string.h>


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

就业数据资源平台