struct student temp,*p=&temp; temp.name=\chou\;
则下面不正确的是___。
表达式 值 A p->name chou B (*p)->name+2 h C *p->name+2 e D *(p->name+2) o 9 下面程序运行后,其输出结果是___。
#include
{ int x; char *s; }t; func(struct tree t)
{ t.x=10; t.s=\computer\; return 0; } main()
{ t.x=1; t.s=\minicomputer\;
func(t); printf(\%d,%s\\n\,t.x,t.s); }
A 10,computer B 1,minicomputer C 1,computer D 10,minicomputer 10 下列程序的输出结果是___。
#include
{ int i[2]; long k; char c[4]; }t,*s=&t; s->i[0]=0x39; s->i[1]=0x38;
printf(\%lx \,s->k); printf(\%c\\n\,s->c[0]); }
A 390038 39 B 380039 9 C 3938 38 D 3839 8 11 若已定义了如下的共用体类型变量x,则x所占用的内存字节数为___。
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(\%d\\n\,B); 输出是___。
A 5 B 3 C 2 D 编译时出错 13 有以下说明语句,则结构变量s的成员num的不正确引用是___。
struct student { int num; int age;
34
}s,*p;
A s.num B *p.num C p->num D (*p).num 14 以下各选项试图说明一种新的类型名,其中正确的是 。
A typedef integer int; B typedef integer=int; C typedef int integer; D typedef int=integer; 15 运行下面程序,其输出结果是___。
#include
{ int a,b; char *ch; }; main()
{ struct sample arg;
arg.a=1000;arg.b=100;arg.ch=\abcd\; f1(arg); }
f1(struct sample param) { param.a+=param.b; param.ch[2]='x';
printf(\%d\\n\,param.a); printf(\%s\\n\,param.ch); }
A 1000 B 1100 C 1100 D 100 abcd abcd abxd abcd 16 fwrite函数的一般调用形式是___。
A fwrite(buffer,count,size,fp); B fwrite(fp,size,count,buffer); C fwrite(fp,count,size,buffer); D fwrite(buffer,size,count,fp); 17 C语言文件操作函数fread(buffer,size,n,fp)的功能是___。
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 7 B 4 C 1 D 2
35
习题集答案
基础知识
一 单项选择题(每题2分,共44分)
A B A D C C B B B C 1-5 6-10 11-15 16-22 A D A C A A D C B C A A 二 填空题(第1题2分,其余每题3分,共56分) 1 x%2==0 2 a=2,b=3,c=4↙ 12 3 -12 4 10 13 11 12 a=5 c=6 b=5 d=18 【1】A#B#C 【2】A# #B 5 -14 14 5.169000 【1】scanf(\%c\,&ch); 15 【2】ch-=32; 【3】printf(\%c\\n\,ch); 16 a=98,b=765.000000,c=4321.000000 123.12346 123.123457 00012345 abcdefgh 6 32767,32767 7 15 8 10,A,10 17 10,12,a 9 10,8,16 10,a 10 28
18 abc 19 a=3,b=5,x=35.000000,y=35.119999,c1=a,c2=b 36
顺序、选择结构程序设计
一 单项选择题(每题2分,共40分)
1-5 6-10 B C A D A
C D B D C C B D C A C D C D D 11-15 16-20 二 填空题(每空3分,共30分)
1 9,10 2 000 i= 11 j= 15 3 k= 33 4 a=98,b=76.0,c=54 5 67,D
6 20 7 8,9 8 (x>=y)&&(y>=z) 9 **3 10 14 三 程序填空题(每空5分,共30分)
1 【1】6.6
2 【2】#include
【5】a+b>c && b+c>a && c+a>b && a>0 && b>0 && c>0 【6】p=(a+b+c)/2.0;
37
循环结构程序设计
一 单项选择题(每题2分,共40分)
1-5 6-10 D B A D B
B C A B C 11-15 16-20 A A C B A C C C D C 二 填空题(每空3分,共33分)
1 2 3 4
0 无限多次 3,2,-1 【1】b=i+1 【2】c-11 5 【1】i<10 【2】j%3 6 5 7 18或19 8 【1】1.0/(i*i) 【2】sqrt(6*s) 三 程序填空题(每空3分,共27分)
1 【1】i<=50 【2】i=i+2 【3】sum 2 【1】x 【2】min=x 【3】x>=0
3 【1】n<=999;n++ 【2】n/10 【3】n==i*i*i+j*j*j+k*k*k
38
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C语言程序设计习题集及答案_V2014(8)在线全文阅读。
相关推荐: