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

1、 问题:#include<stdio.h> #include<string.h> struct A {int a; char b[10]; double c;}; void f(struct A t); main() {struct A a={1001,”ZhangDa”,1098.0}; f(a); printf(“%d,%s,%6.1f\n”,a.a,a.b,a.c); } void f(struct A t) {t.a=1002; strcpy(t.b,”Chang

A、1001,zhangDa,1098.0
B、1002,chang Rong,1202.0
C、1001,changRong,1098.0
D、1002,Zhang Da,1202.0

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

2、 问题:#include <stdio.h> struct ord { int x,y;} dt[2]={1,2,3,4}; main( ) { struct ord *p=dt; printf(“%d,”,++p->x); printf(“%d\n”,++p->y); } 程序的运行结果是

A、1,2
B、2,3
C、3,4
D、4,1

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

3、 问题:#include <stdio.h> struct st { int x, y;} data[2]={l,10,2,20}; main() { struct st *p=data; printf(“%d,”, p->y); printf(“%d\n”,(++p)->x); } 程序的运行结果是

A、10,1
B、20,1
C、10,2
D、20,2

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

4、 问题:#include <stdio.h> main() { struct STU { char name[9]; char sex; double score[2]; }; struct STU a={“Zhao”,’m’,85.0,90.0),b={“Qian”,’f’,95.0,92.0); b=a; printf(“%s,%c,%2.0f,%2.0f\n”,b.name,b.sex,b.score[0],b.score[1]); } 程序的运行结果是

A、Qian,f,95,92
B、Qian,m,85,90
C、Zhao,f,95,92
D、Zhao,m,85,90

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

5、 问题:有以下程序  struct S  { int a,b;} data[2]={10,100,20,200};  main()  { struct S p=data[1];   printf(“%d\n”,++(p.a));  }  程序运行后的输出结果是

A、10
B、11
C、20
D、21

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

6、 问题:#include <stdio.h> typedef struct {int num;double s;} REC; void fun1(REC x) {x.num=23;x.s=88.5;} main() { REC a={16,90.0}; fun1(a); printf(“%d “,a.num); } 上述程序的输出结果为__

A、16
B、23
C、90

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

7、 问题:下程序运行结果__ #include <stdio.h> #include <string.h> struct A {int a; char b[10]; double c; }; void f (struct At); main() {struct A a={1001,”ZhangDa”,1098.0}; f(a); printf(“%d,%s,%6.1f ”,a.a,a.b,a.c); } void f(struct At) { strcpy(t->b,

A、1001,ZhangDa,1098.0
B、1001,ChangRong,1098.0
C、1001,”ZhangDa”,1098.0
D、1001,”ChangRong”,1098.0

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

8、 问题:以下程序运行后的输出结果是__ struct NODE { int num; struct NODEnext; } main() { struct NODE s[3],p,q,r; int sum=0; s[0].num=1; s[1].num=2; s[2].num=3; s[0].next=s+1; s[1].next=s+2; s[2].next=s; p=s; q=p->next; r=q->next; sum+=q->next->num; sum

A、1
B、2
C、4
D、5

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

9、 问题:函数fun的功能是统计person所指结构体数组中所有性别(sex)为M的记录的个数存入n中,请填空: #define N 3 typedef struct {int num; char nam[10]; char sex;} SS; int fun(SS person[]) {int i,n=0; for(i=0;i<N;i++) if(______==’M’ ) n++; return n; } main() {SS W[N]={{1,”AA”,’F’},{2,”BB”,’M’

A、person[i]
B、person[i].name
C、person[i].sex

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

10、 问题:以下程序运行后的输出结果是__ #include <stdio.h> main() { charp; int i;  p=(char)malloc(sizeof(char)20);  strcpy(p,”welcome”);  for(i=6;i>=0;i–) putchar((p+i));  printf(” -“); free(p); }

A、welcome
B、emocle
C、emoclew
D、elcome

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

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<stdio.h> intmain() { 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 stnext; }; 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

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