历年真题
printf(“%d,%s,%6.1f\n”,a.a,a.b,a.c);} void f(struct At)
{t.a=1002;strcpy(t.b,“ChangRong”);t.c=1202.0;} 输出结果是
A)1001,ZhangDa,1098.0 B)1002,ChangRong,1202.0 C)1001,ChangRong,10980 D)1002,ZhangDa,1202.0 (38)有以下定义和语句 struct workers
{int num;char name[20];char c; struct
{int day;int month;int year;}s };
struct workers w,*pw; pw=&w;
能给w中year成员赋1980的语句是
A)pw.year=1980; B)w.year=1980; C)pw->year=1980; D)w.s.year=1980; (39)有以下程序 #include<stdio.h> main()
{int a=2,b=a,c=2;
printf(“%d\n”,a/b&c); }
程序运行后的输出结果是
A)0 B)1 C)2 D)3 (40)有以下程序 #include<stdio.h> main()
{FILE *fp;char str[10];
fp=open(“myfile.dat”,“w”); fputs(“abc”,pf);close(pf); fp=open(“myfile.dat”,“a+”); fprintf(pf,“%d”,28); rewind(pf);
fscanf(pf,“%s”,str);puts(str); close(pf); }
程序运行后的输出结果是
A)abc B)28c
C)abc28 D)因类型不一致而出错 二、填空题(每空2分,共30分)
请将每空的正确答案写在答题卡【1】~【15】序号的横线上,答在试卷上不得分。