当前位置:首页 >课程 >C语言程序设计

1、若有以下语句 typedef struct S { int g; char h; } T; 以下叙述中正确的是()。

A、可用S定义结构体变量
B、可用T定义结构体变量
C、S是struct 类型的变量
D、T是struct S类型的变量

参考答案:请扫码使用小程序查看答案

2、若已经定义: struct stu { int a, b; } student ; 则下列输入语句中正确的是( )

A、scanf("%d",&a);
B、scanf("%d",&student);
C、scanf("%d",&stu.a);
D、scanf("%d",&student.a);

参考答案:请扫码使用小程序查看答案

3、有以下程序 #include struct ball { char color[10]; int dim; }; int main( ) { struct ball list[2] = {{"white", 2}, {"yellow", 3}}; printf("%s:%d ", (list+1)->color, list->dim); return 0; } 程序运行后的输出结果是( )

A、yellow:3
B、yellow:2
C、white:2
D、white:3

参考答案:请扫码使用小程序查看答案

4、以下叙述中正确的是()。

A、结构体数组名不能作为实参传给函数
B、结构体变量的地址不能作为实参传给函数
C、结构体中可以含有指向本结构体的指针成员
D、即使是同类型的结构体变量,也不能进行整体赋值

参考答案:请扫码使用小程序查看答案

5、有以下程序 #include #include struct S { char name[10]; }; void change(struct S *data, int value) { strcpy(data->name, "#"); value = 6; } int main( ) { struct S input; int num = 3; strcpy(input.name, "OK"); change(&input, num); printf(

A、8,17
B、8,16
C、8,8
D、8,20

参考答案:请扫码使用小程序查看答案

6、结构体成员的类型必须是基本数据类型。

参考答案:请扫码使用小程序查看答案

7、结构体数组中可以包含不同结构体类型的结构体变量。

参考答案:请扫码使用小程序查看答案

8、结构体类型本身不占用内存空间,结构体变量占用内存空间。

参考答案:请扫码使用小程序查看答案

9、以下关于C语言数据类型使用的叙述中错误的是( )。

A、若要准确无误差的表示自然数,应使用整数类型
B、若要保存带有多位小数的数据,应使用双精度类型
C、若要处理如“人员信息”等含有不同类型的相关数据,应自定义结构体类型
D、若只处理“真”和“假”两种逻辑值,应使用逻辑类型

参考答案:请扫码使用小程序查看答案

10、下面有关typedef语句的叙述中,正确的是( )

A、typedef语句用于定义新类型
B、typedef语句用于定义新变量
C、typedef语句用于给已定义类型取别名
D、typedef语句用于给已定义变量取别名

参考答案:请扫码使用小程序查看答案

11、若已经定义 typedef struct stu { int a, b; } student ; 则下列叙述中正确的是( )

A、stu 是结构体变量
B、student 是结构体变量
C、student 是结构体类型
D、a和 b是结构体变量

参考答案:请扫码使用小程序查看答案

12、C语言中结构体类型变量在程序执行期间( )

A、所有成员一直驻留在内存中
B、只有一个成员驻留在内存中
C、部分成员驻留在内存中
D、没有成员驻留在内存中

参考答案:请扫码使用小程序查看答案

13、以下叙述中正确的是( )

A、结构体中的成员不能是结构体类型
B、结构体的类型不能是指针类型
C、结构体中成员的名字可以和结构体外其他变量的名称相同
D、在定义结构体类型时就给结构体分配存储空间

参考答案:请扫码使用小程序查看答案

14、以下程序的运行结果是( ) #include int main() { struct date { int year,month,day; }today; printf("%d",sizeof(struct date)); return 0; }

A、6
B、8
C、10
D、12

参考答案:请扫码使用小程序查看答案

15、已知: struct sk { int a; float b;}data,*p; 若有p=&data,则对data中的成员a的正确引用是( )

A、(*p).data.a
B、(*p).a
C、p->data.a
D、p.data.a

参考答案:请扫码使用小程序查看答案

16、若有以下定义语句: struct student { int num,age;}; struct student stu[3]={{101,20},{102,19},{103,18}},*p=stu; 则以下错误的引用是( )

A、(p++)->num
B、p++
C、(*p).num
D、p=&stu.age

参考答案:请扫码使用小程序查看答案

17、设有一结构体类型变量定义如下: struct date { int year; int month; int day; }; struct worker { char name[20]; char sex; struct date birthday; }w1; 若对结构体变量w1的出生年份进行赋值,下面正确的赋值语句是( )

A、year=1976
B、birthday.year=1976
C、w1.birthday.year=1976
D、w1.year=1976

参考答案:请扫码使用小程序查看答案

18、已知: struct person { char name[10]; int age; }class[10]={"LiMing",29,"ZhangHong",21,"WangFang",22}; 下述表达式中,值为72的一个是( )

A、class[0]->age + class[1]->age+ class[2]->age
B、class[1].name[5]
C、person[1].name[5]
D、clase->name[5]

参考答案:请扫码使用小程序查看答案

19、若已经定义: struct stu { int a, b; } student ; 则下列输入语句中正确的是( )

A、scanf("%d",&a);
B、scanf("%d",&student);
C、scanf("%d",&stu.a);
D、scanf("%d",&student.a);

参考答案:请扫码使用小程序查看答案

20、已知: struct st { int n; struct st *next; }; static struct st a[3]={1,&a[1],3,&a[2],5,&a[0]},*p; 如果下述语句的显示是2,则对p的赋值是( ) printf("%d",++(p->next->n));

A、p=&a[0];
B、p=&a[1];
C、p=&a[2];
D、p=&a[3];

参考答案:请扫码使用小程序查看答案

21、有如下定义: struct person { char name[9];int age;}; struct person class[10]={"John",17, "Paul",19, "Mary",18, "Jack",19}; 根据上述定义,能输出字母M的语句是( )

A、printf("%c\n",class[3].name);
B、printf("%c\n",class[3].name[1]);
C、printf("%c\n",class[2].name[1]);
D、printf("%c\n",class[2].name[0]);

参考答案:请扫码使用小程序查看答案

22、链表不具有的特点是( )

A、插入、删除不需要移动元素
B、可随机访问任一元素
C、不必事先估计存储空间
D、所需空间与线性长度成正比

参考答案:请扫码使用小程序查看答案

23、设有以下链表,则不能将q所指的结点插入到链表末尾的是( )

A、q->next=NULL;p=p->next;p->next=q;
B、p=p->next;q->next=p->next;p->next=q;
C、p=p->next;q->next=p;p->next=q;
D、p=(*p).next;(*q).next=(*p).next;(*p).next=q;

参考答案:请扫码使用小程序查看答案

24、在单链表指针为p的结点之后插入指针为 s的结点, 正确的操作是 ( )

A、p->next=s;s->next=p->next;
B、s->next=p->next;p->next=s;
C、p->next=s;p->next=s->next;
D、p->next=s->next;p->next=s;

参考答案:请扫码使用小程序查看答案

25、对于一个头指针为 head 的带头结点的单链表,判定该表为空表的条件 是( )

A、head==NULL
B、head->next==NULL
C、head->next==head
D、head!=NULL

参考答案:请扫码使用小程序查看答案