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

36、有以下函数


#include <sthio.h>


Viod exch(int t[ ])


{t[0]=t[5];}


{int x[10]={1,2,3,4,5,6,7,8,9,10},i=0;


While(i<=4) {exch(&x[i])’i++;}


for(i=0;i<5;i++)   printf(“%d”,x[i]);


printf(“\n”);


}


程序运行输出结果是


A 2 4 6 8 10   B 1 3 5 7 9    C 1 2 3 4 5    D 6 7 8 9 10


37、设有以下程序段


Struct  MP3 


{char name[20];


 Char color;


Float price;


}std,*ptr;中华考试网(www.Examw。com)


ptr=& std;


若要引用结构体变量std中的color成员,写法错误的是


A std.color    B ptr-> color        C std-> color    D (*ptr) .color   


38、有以下函数


#include <sthio.h>


struct stu


{int mun;  char  name[10];  int age;};


viod fun(struct stu *p)


{ printf(“%s\n”,p->name);}


mian()


{ struct stu x[3]={{01,”zhang”,20},{02,”wang”,19},{03,”zhao”,18}};


fun(x+2);


}


程序运行输出结果是


A  zhang     B  zhao   C  wang   D  19


39、有以下函数


#include <sthio.h>


mian()


{int a=12,c;


c=(a<<2)<<1;


printf(“%d\n”,c):


}


程序运行输出结果是


A  3      B   50    C 2    D 96


40、以下函数不能用于向文件写入数据的是


A  ftell        B fwrite         C fputc          D fprintf


36-40、DCBDA

就业数据资源平台