C语言程序设计第九章作业.docx

上传人:公**** 文档编号:563357700 上传时间:2023-12-30 格式:DOCX 页数:4 大小:14.27KB
返回 下载 相关 举报
C语言程序设计第九章作业.docx_第1页
第1页 / 共4页
C语言程序设计第九章作业.docx_第2页
第2页 / 共4页
C语言程序设计第九章作业.docx_第3页
第3页 / 共4页
C语言程序设计第九章作业.docx_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《C语言程序设计第九章作业.docx》由会员分享,可在线阅读,更多相关《C语言程序设计第九章作业.docx(4页珍藏版)》请在金锄头文库上搜索。

1、一、 单选题 (每小题10分,共100分,得分 90 分) 1、有关宏定义的正确说明是。 A、可出现在一行中的任何位置 B、只能放在程序的开头,且每一个宏定义单独占一行 C、可出现在程序的任何位置 D、以#开头的行,可出现在程序的任何位置,通常每一个宏定义只能单独占一行,使用字符“”可实现一个宏定义占用若干行 你的回答: D () 参考答案:D 2、结构是C语言的构造数据类型。下面定义了一个职工结构employee、结构变量emp1和结构指针变量p:struct employee int num; /职工编号 char name10; /职工姓名emp1,*p;p=&emp1;正确使用结构变量

2、emp1的语句是: A、scanf(%d%s,&p-num,p-name); B、scanf(%d%s,&p-num,&p-name); C、scanf(%d%s,&p.num,p.name); D、scanf(%d%s,&p.num,&p.name); 你的回答: A () 参考答案:A 3、下面定义了一个通信录结构friends_list、结构变量friend1struct friends_listint num; /编号char name10; /姓名char telephone13; /电话int age; /年龄friend1;正确使用结构变量friend1的语句是 A、friend

3、1.name=xiaojie; B、friend1-name=xiaojie; C、 D、 你的回答: A () 参考答案: 4、下面定义了一个通信录结构friends_list、结构变量friend1struct friends_listint num; /编号char name10; /姓名char telephone13; /电话int age; /年龄friend1;正确使用结构变量friend1的语句是 A、friend1.name=xiaojie; B、friend1-name=xiaojie; C、strcpy(friend1.name,xiaojie); D、strcpy(fr

4、iend1-name,xiaojie); 你的回答: C () 参考答案:C 5、下面定义了一个通信录结构friends_list、结构变量friend1struct friends_listint num; /编号char name10; /姓名char telephone13; /电话int age; /年龄friend1;正确使用结构变量friend1的scanf语句是 A、sacnf(%d%s%s%d,&friend1.num,&friend1.name,&friend1.telephone,&friend1.age); B、sacnf(%d%s%s%d,&friend1.num,fr

5、iend1.name,friend1.telephone,&friend1.age); C、sacnf(%d%s%s%d,friend1.num,&friend1.name,&friend1.telephone,friend1.age); D、sacnf(%d%s%s%d,friend1.num,friend1.name,friend1.telephone,friend1.age); 你的回答: B () 参考答案:B 6、5、下面定义了一个日期结构date、结构变量date1和date2struct date int year; int month; int day;date1=2000,1

6、,1,date2;对结构变量date2正确操作的语句是 A、date2=date1; B、strcpy(date2,date1); C、date2=2010,12,1; D、date2=2010-12-1; 你的回答: A () 参考答案:A 7、下面定义了一个日期结构struct datestruct date int year; int month; int day;date1;结构类型占用的内存空间可用sizeof来计算,正确的sizeof格式是 A.sizeof(date1) B.sizeof(struct date) C.sizeof(struct date date1) D.siz

7、eof(date) A、A正确 B、B正确 C、A和B都正确 D、C和D都正确 你的回答: C () 参考答案:C 8、下面定义了一个日期结构struct datestruct date int year; int month; int day;date1;该结构类型占用的内存空间是多少字节 A、6 B、9 C、12 D、15 你的回答: C () 参考答案:C 9、下面定义了一个平面点结构struct point、结构变量point1和结构指针pstruct point double x; double y;point1,*p=&point1;欲将点(100,100)赋值给point1,则不正确的操作语句是 A、point1.x=100;point1.y=100; B、*p.x=100;*p.point1.y=100; C、(*p).x=100;(*p).point1.y=100; D、p-x=100;p-y=100; 你的回答: B () 参考答案:B 10、关于嵌套结构的定义描述,正确的是: A、在定义嵌套的结构类型时,必须先定义成员的结构类型,再定义主结构类型 B、在定义嵌套的结构类型时,必须先定义主结构类型,再定义成员的结构类型 C、在定义嵌套的结构类型时,成员的结构类型和主结构类型的先后顺序无关紧要 D、以上描述都不正确 你的回答: A () 参考答案:A

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号