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

全国等级考试资料网 2019-01-23 14:14:54 116

36、有以下函数

#include 

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(“ ”);

}

程序运行输出结果是

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 

struct stu

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

viod fun(struct stu *p)

{ printf(“%s ”,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 

mian()

{int a=12,c;

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

printf(“%d ”,c):

}

程序运行输出结果是

A  3      B   50    C 2    D 96

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

A  ftell        B fwrite         C fputc          D fprintf

36-40、DCBDA

相关资料

相关阅读