6 若要用fopen函数建一个新的二进制文件,该文件要既能读也能写,则文件方式字符串应该为_B__。
A \7 下列程序运行后的输出结果是__A_。
struct s { int n; char *c; }*p; char d[]={'a','b','c','d','e'};
struct s a[]={10,&d[0],20,&d[1],30,&d[2],40,&d[3],50,&d[4]}; #include
printf(\printf(\printf(\}
A 11 B 11 C 10 D 10 20 20 20 20 c b c b 8 已知
struct student
{ char *name; int student_no; char grade; }; struct student temp,*p=&temp; temp.name=\
则下面不正确的是_B__。
表达式 值 A p->name chou B (*p)->name+2 h C *p->name+2 e D *(p->name+2) o 9 下面程序运行后,其输出结果是_B__。
#include
{ int x; char *s; }t; func(struct tree t)
{ t.x=10; t.s=\main()
{ t.x=1; t.s=\ func(t); printf(\}
A 10,computer B 1,minicomputer C 下列程序的输出结果是__B_。
#include
D 1,computer 10,minicomputer
10 { int i[2];
long k; char c[4]; }t,*s=&t;
s->i[0]=0x39; s->i[1]=0x38;
printf(\printf(\}
A 390038 39 B 380039 9 C 3938 38 D 3839 8 11 若已定义了如下的共用体类型变量x,则x所占用的内存字节数为__C_。
union data { int i; char cha; double f; }x;
A 7 B 11 C 8 D 10 12 如下说明语句:
enum A {A0=1,A1=3,A2,A3,A4,A5}; enum A B;
执行 B=A3; printf(\输出是_A__。
A 5 B 3 C 2 D 编译时出错
13 有以下说明语句,则结构变量s的成员num的不正确引用是_B__。
struct student { int num;
int age; }s,*p;
A s.num B *p.num C p->num D (*p).num 14 以下各选项试图说明一种新的类型名,其中正确的是 C 。
A typedef integer int; B typedef integer=int; C typedef int integer; D typedef int=integer; 15 运行下面程序,其输出结果是__C_。
#include
{ int a,b; char *ch; }; main()
{ struct sample arg;
arg.a=1000;arg.b=100;arg.ch=\f1(arg); }
f1(struct sample param) { param.a+=param.b;
param.ch[2]='x';
printf(\printf(\
}
A 1000 B 1100 C 1100 D 100 abcd abcd abxd abcd 16 fwrite函数的一般调用形式是_D__。
A
fwrite(buffer,count,size,fp);
fwrite(fp,size,count,buffer);
C
fwrite(fp,count,size,buffer);
fwrite(buffer,size,count,fp);
17 C语言文件操作函数fread(buffer,size,n,fp)的功能是_B__。
A 从文件fp中读n个字节存入buffer
B 从文件fp中读n个大小为size字节的数据项存入buffer中 C 从文件fp中读入n个字节放入大小为size字节的缓冲区buffer中 D 从文件fp中读入n个字符数据放入buffer中 18 若有如下定义:
struct data
{ int i; char ch; float f; }b; 则结构体变量b占用内存的字节数是 A 。
A 7 B 4 C 1 D 2
指针
一 单项选择题(每题2分,共40分)
1-5 6-10 B B B A C D A C B B 11-15 16-20 二 填空题(每空D A D 3分,共A A 30分) B A C C A 1① 2 5⑥ 2 1② 2468 6⑦ 12 B
D
2③ 3④ 4⑤ 2 5 4 55 6⑧ 12 7⑨ a0] 7⑩ a[3] 三 程序填空题(每空3分,共30分)
【1】 str[0] 【6】 str[i] 【2】 *sp=str[i] 【7】 j=i 【3】 *p 【8】 k+1 【4】 *p-'0' 【9】 a+1 【5】 j-- 【10】n+'0'
结构体 文件
单项选择题(1~8题每题5分,9~18题每题6分,共100分)
1-5 6-10 B A B B B A D B D C 11-15 16-18 D B A C A B C C

