资源描述:
《C语言程序设计第九章作业.docx》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一、单选题(每小题10分,共100分,得分90分)1、有关宏定义的正确说明是_____。A、可出现在一行中的任何位置B、只能放在程序的开头,且每一个宏定义单独占一行C、可出现在程序的任何位置D、以#开头的行,可出现在程序的任何位置,通常每一个宏定义只能单独占一行,使用字符“”可实现一个宏定义占用若干行你的回答:D(√)参考答案:D2、结构是C语言的构造数据类型。下面定义了一个职工结构employee、结构变量emp1和结构指针变量p:structemployee{intnum;//职工编号char
2、name[10];//职工姓名}emp1,*p;p=&emp1;正确使用结构变量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(√)参考答案:A3、下面定义了一个通信录结构friends_list、结构变量friend1structfriends_list{intnu
3、m;//编号charname[10];//姓名chartelephone[13];//电话intage;//年龄}friend1;正确使用结构变量friend1的语句是A、friend1.name="xiaojie";B、friend1->name="xiaojie";C、D、你的回答:A(√)参考答案:4、下面定义了一个通信录结构friends_list、结构变量friend1structfriends_list{intnum;//编号charname[10];//姓名chartelephone[
4、13];//电话intage;//年龄}friend1;正确使用结构变量friend1的语句是A、friend1.name="xiaojie";B、friend1->name="xiaojie";C、strcpy(friend1.name,"xiaojie");D、strcpy(friend1->name,"xiaojie");你的回答:C(√)参考答案:C5、下面定义了一个通信录结构friends_list、结构变量friend1structfriends_list{intnum;//编号char
5、name[10];//姓名chartelephone[13];//电话intage;//年龄}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,friend1.name,friend1.telephone,&friend1.age);C、sacnf("%d%s%s%d
6、",friend1.num,&friend1.name,&friend1.telephone,friend1.age);D、sacnf("%d%s%s%d",friend1.num,friend1.name,friend1.telephone,friend1.age);你的回答:B(√)参考答案:B6、5、下面定义了一个日期结构date、结构变量date1和date2structdate{intyear;intmonth;intday;}date1={2000,1,1},date2;对结构变量dat
7、e2正确操作的语句是A、date2=date1;B、strcpy(date2,date1);C、date2={2010,12,1};D、date2={2010-12-1};你的回答:A(√)参考答案:A7、下面定义了一个日期结构structdatestructdate{intyear;intmonth;intday;}date1;结构类型占用的内存空间可用sizeof来计算,正确的sizeof格式是A.sizeof(date1)B.sizeof(structdate)C.sizeof(structd
8、atedate1)D.sizeof(date)A、A正确B、B正确C、A和B都正确D、C和D都正确你的回答:C(√)参考答案:C8、下面定义了一个日期结构structdatestructdate{intyear;intmonth;intday;}date1;该结构类型占用的内存空间是多少字节A、6B、9C、12D、15你的回答:C(√)参考答案:C9、下面定义了一个平面点结构structpoint、结构变量point1和结构指针pstructpoint{doublex