【计算机类职业资格】结构体、共用体和用户定义类型及答案解析.doc

上传人:sofeeling205 文档编号:1336364 上传时间:2019-10-17 格式:DOC 页数:4 大小:39KB
下载 相关 举报
【计算机类职业资格】结构体、共用体和用户定义类型及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】结构体、共用体和用户定义类型及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】结构体、共用体和用户定义类型及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】结构体、共用体和用户定义类型及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、结构体、共用体和用户定义类型及答案解析(总分:12.00,做题时间:90 分钟)一、B选择题/B(总题数:8,分数:8.00)1.以下程序的输出结果是_。 main() union char i2;int k; r; r.i0=2;r.i1=0; printf(“%d/n“r.k); (分数:1.00)A.2B.1C.0D.不确定2.有以下结构体说明和变量的定义,且如图 14-4 所示的指针 p 指向变量 a,指针 q 指向变量 b。则不能把结点 b 连接到结点 a 之后的语句是_。 (分数:1.00)A.next=q;B.next= main () struct abc s2=1,2,3,4

2、5,6; int t;t=s0a+s1.b; printf(“%d/n“,t); (分数:1.00)A.5B.6C.7D.87.若要说明一个类型名 CHARP,使得定义语句“CHARP s;”等价于“char *s;”,以下选项中正确的是_。(分数:1.00)A.typedef CHARP char*s;B.typedef * char CHARP;C.typedef CHARP *char:D.typedef char*CHARP;8.以下叙述错误的是_。(分数:1.00)A.共用体的所有变量都有一个相同的地址B.结构体变量可以作为共有用体中的成员C.共用体的成员一个时刻只有一个生效D.要

3、传递共用体的成员通常采用函数二、B填空题/B(总题数:2,分数:4.00)9.有以下定义和语句,则 sizeof(a)的值是_,而 sizeof(a.share)的值是_。 struct dateint day; int month; int year; union int share 1; float share2; share; a;(分数:2.00)填空项 1:_10.以下函数 creat 用来建立一个带头结点的单向链表,新产生的结点总是插在链表的末尾。单向链表的头指针作为函数值返回。请填空。 #include stdio.h struct list char dara; struct

4、list *next; ; struct list *creat() struct list *h,*p,*q; char ch; h= (struct list (*) malloc (sizeof (struct list); _; ch=getchar(); while(ch!=?) p=(struct list*) malloc) sizeof (struct list); p-data=ch; _; q=p; ch=getchar(); p-next=/0; _: (分数:2.00)填空项 1:_结构体、共用体和用户定义类型答案解析(总分:12.00,做题时间:90 分钟)一、B选择

5、题/B(总题数:8,分数:8.00)1.以下程序的输出结果是_。 main() union char i2;int k; r; r.i0=2;r.i1=0; printf(“%d/n“r.k); (分数:1.00)A.2 B.1C.0D.不确定解析:2.有以下结构体说明和变量的定义,且如图 14-4 所示的指针 p 指向变量 a,指针 q 指向变量 b。则不能把结点 b 连接到结点 a 之后的语句是_。 (分数:1.00)A.next=q;B.next= main () struct abc s2=1,2,3,4,5,6; int t;t=s0a+s1.b; printf(“%d/n“,t);

6、 (分数:1.00)A.5B.6 C.7D.8解析:7.若要说明一个类型名 CHARP,使得定义语句“CHARP s;”等价于“char *s;”,以下选项中正确的是_。(分数:1.00)A.typedef CHARP char*s;B.typedef * char CHARP;C.typedef CHARP *char:D.typedef char*CHARP; 解析:8.以下叙述错误的是_。(分数:1.00)A.共用体的所有变量都有一个相同的地址B.结构体变量可以作为共有用体中的成员C.共用体的成员一个时刻只有一个生效 D.要传递共用体的成员通常采用函数解析:二、B填空题/B(总题数:2,

7、分数:4.00)9.有以下定义和语句,则 sizeof(a)的值是_,而 sizeof(a.share)的值是_。 struct dateint day; int month; int year; union int share 1; float share2; share; a;(分数:2.00)填空项 1:_ (正确答案:10,4)解析:10.以下函数 creat 用来建立一个带头结点的单向链表,新产生的结点总是插在链表的末尾。单向链表的头指针作为函数值返回。请填空。 #include stdio.h struct list char dara; struct list *next; ; struct list *creat() struct list *h,*p,*q; char ch; h= (struct list (*) malloc (sizeof (struct list); _; ch=getchar(); while(ch!=?) p=(struct list*) malloc) sizeof (struct list); p-data=ch; _; q=p; ch=getchar(); p-next=/0; _: (分数:2.00)填空项 1:_ (正确答案:p=q=h,q-next=p,return(h)或 return h)解析:

展开阅读全文
相关资源
猜你喜欢
  • SIS SS-ISO 1701-0-1992 Test conditions for milling machines with table of variable height with horizontal or vertical spindle  Part 0 General introduction《有可变高度、水平或纵向主轴的铣床测试条件 第0部分.pdf SIS SS-ISO 1701-0-1992 Test conditions for milling machines with table of variable height with horizontal or vertical spindle Part 0 General introduction《有可变高度、水平或纵向主轴的铣床测试条件 第0部分.pdf
  • SIS SS-ISO 1701-1992 Test conditions for milling machines with table of variable height with horizontal or vertical splndle  Testing of accuracy《有可变高度表、水平或纵向主轴的铣床测试条件 准确性测试》.pdf SIS SS-ISO 1701-1992 Test conditions for milling machines with table of variable height with horizontal or vertical splndle Testing of accuracy《有可变高度表、水平或纵向主轴的铣床测试条件 准确性测试》.pdf
  • SIS SS-ISO 1708-1986 Test conditions for general purpose parallel lathes-Testing of the accuracy《通用平行车床测试条件 精度测试》.pdf SIS SS-ISO 1708-1986 Test conditions for general purpose parallel lathes-Testing of the accuracy《通用平行车床测试条件 精度测试》.pdf
  • SIS SS-ISO 1718-1991 Rock drilling equipment  Drill rods with tapered connection for percussive drilling《凿岩设备 用于冲击钻进、带有锥形连接的钻杆》.pdf SIS SS-ISO 1718-1991 Rock drilling equipment Drill rods with tapered connection for percussive drilling《凿岩设备 用于冲击钻进、带有锥形连接的钻杆》.pdf
  • SIS SS-ISO 1724-1981 Road vehicles- Electrical connections between towing vehicles and towed vehicles with 6 or 12 V electrical equipment - Type 12 N (normal)《道路车辆 配备6伏或12伏电气设备的拖车和.pdf SIS SS-ISO 1724-1981 Road vehicles- Electrical connections between towing vehicles and towed vehicles with 6 or 12 V electrical equipment - Type 12 N (normal)《道路车辆 配备6伏或12伏电气设备的拖车和.pdf
  • SIS SS-ISO 1726-1991 Road vehicles  Mechanical coupling between tractors and semi-trailers  Interchangeability《道路车辆 拖拉机和半拖车间的机械耦合 互换性》.pdf SIS SS-ISO 1726-1991 Road vehicles Mechanical coupling between tractors and semi-trailers Interchangeability《道路车辆 拖拉机和半拖车间的机械耦合 互换性》.pdf
  • SIS SS-ISO 1728-1991 Road vehicles  Pneumatic braking connec- tions between motor vehicles and towed vehicles  Interchangeability《道路车辆 机动车辆和牵引车辆之间的压缩空气制动连接 互换性》.pdf SIS SS-ISO 1728-1991 Road vehicles Pneumatic braking connec- tions between motor vehicles and towed vehicles Interchangeability《道路车辆 机动车辆和牵引车辆之间的压缩空气制动连接 互换性》.pdf
  • SIS SS-ISO 1746-1990 Rubber or plastics hoses and tubing  Bending tests《橡胶或塑料软管和管 弯曲试验》.pdf SIS SS-ISO 1746-1990 Rubber or plastics hoses and tubing Bending tests《橡胶或塑料软管和管 弯曲试验》.pdf
  • SIS SS-ISO 175-1987 Plastics - Determ i nation of the effects of liquid chemicals including water《塑料 液体化学品的影响,包括水》.pdf SIS SS-ISO 175-1987 Plastics - Determ i nation of the effects of liquid chemicals including water《塑料 液体化学品的影响,包括水》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1