内容正文:
编写说明:《计算机应用考纲百套卷》依据湖南省《计算机应用类专业知识考试标准》编写,本套试卷共100份,分为三个部分,第一部分是知识点训练卷,共62份,第二部分是常考题训练卷,共18份,第三个部分是专业综合训练卷,参考历年计算机应用类专业真题试卷,编写了20份。
本试卷是《计算机应用考纲百套卷》的第79卷,是第二部分常考题训练卷,根据考纲进行解读,本试卷的知识要点如下所示:
①结构体、共用体的概念和定义。②链表的定义与建立。③链表的插入、删除等操作。
湖南省《计算机应用考纲百套卷》
《计算机编程语言—C语言》
第79卷
常考题训练卷
时间:45分钟 总分:100分
班级___________ 姓名__________ 学号__________ 成绩________
一、选择题(共20小题,每小题3分,合计60分)
1.下列叙述中错误的是( )
A.可以通过typedef增加新的类型
B.可以用typedef将已存在的类型用一个新的名字来代表
C.用typedef定义新的类型名后,原有类型名仍然有效
D.用typedef可以为各种类型起别名,但不能为变量起别名
【答案】A
2.执行以下程序的输出结果是( )
struct tt
{int n1;char n2;float n3;
union uu{int u1[2];char u2[2];}su;}
main()
{printf("%d",sizeof(struct tt));getch();}
A.11 B.12 C.13 D.20
【答案】D
3.已知学生记录的描述如下所示,设变量s中的“生日”为“1995年2月12日”,下列对“生日”的赋值方式中,正确的是( )
struct student{int no;char name[10];char sex;
struct {int year;int month;int day;}birth;}s;
A. year=1995;month=2;day=12;
B. birth.year=1995;birth.month=2;birth.day=12;
C. s.year=1995;s.month=2;s.day=12;
D. s.birth.year=1995;s.birth.month=2;s.birth.day=12;
【答案】D
4.设有说明语句:struct stu{int a;float b;}stutype;,则下列叙述中不正确的一项是( )
A.struct是结构体类型的关键字 B.struct stu 是用户定义的结构体
C.stutype是用户定义的结构体类型名 D.a和b都是结构体成员名
【答案】C
5.C语言结构体类型变量在程序执行期间( )
A.所有成员一直驻留在内存中 B.只有一个成员驻留在内存中
C.部分成员驻留在内存中 D.没有成员驻留在内存中
【答案】A
6.若有以下定义和语句,则不正确的引用是( )
struct student{int age;int num;}stu[3],*p=stu;
A.(p++)->num B.p++ C.(*p).num D.p=&stu.age
【答案】D
7.下列scanf()函数调用语句中,对结构体变量成员引用不正确的是( )
struct pu{char name[10];int age;char sex;}pup[5],*p=pup;
A. scanf("%s",pup[0].name); B. scanf("%d",&pup[0].age);
C. scanf("%c",&(p->sex)); D. scanf("%d",p->age);
【答案】D
8.设有如下所示的定义语句,若要使p指向data中的n域,则正确的赋值语句是( )
struct sk{int n;float x;}data,*p;
A.p=&data.n; B.*p=data.n;
C.p=(struct sk *)&data.n; D.p=(struct sk *)data.n;
【答案】C
9.执行以下程序的运行结果是( )
struct stu{int x;int *y;}*p;int dt[4]={10,20,30,40};
struct stu a[4]={50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]};
main()
{p=a;printf("%d,",++p->x);
printf("%d,",(++p)->x);
printf("%d",++(*p->y));getch();}
A.10,20,20 B.50,60,21 C.51,60,21 D.60,70,31
【答案】C
10.下列关于C语言中共用体类型数据的叙述中,正确的一项是( )
A.可以对共用体变量名直接赋值
B.一个共用体变量中可以同时存放其所有成员
C.一个共用体变量中不能同时存放其所有成员
D.共用体类型定义中不能出现结构类型的成员
【答案】C
11.执行以下程序的输出结果是( )
union pw{int i;char ch[2];}a;
main()
{a.ch[0]=13;a.ch[1]=1;
printf("%d",a.i);getch();}
A.13 B.14 C.268 D.269
【答案】D
12.( )
A.B.C.D.
【答案】
13.设有定义:char s[7][8],(*k)[6],*p;,则以下赋值语句中正确的是( )
A.p=s; B.p=k; C.p=s[1]; D.k=s;
【答案】C
14.结构体在C语言中用来( )
A.定义变量 B.定义函数 C.定义数据类型 D.定义数组
【答案】C
15.下列关于结构体的描述中错误的是( )
A.结构体可以包含不同数据类型的成员
B.结构体变量占用连续的内存空间
C.结构体可以作为函数的参数和返回值
D.结构体可以嵌套定义
【答案】B
16.在C语言中,结构体的成员可以通过( )方式访问
A.点号运算符(.) B.星号运算符(*)
C.换行符(
) D.逗号(,)
【答案】A
17.下列选项中最准确地描述了C语言结构体的定义方式的是( )
A.struct{int x;float y;}s; B.struct(int x,float y);
C.struct s{int x;int y}; D.struct{int x,float y}s;
【答案】A
18.下列代码片段中,声明了一个名为student的结构体,其中包含了姓名和年龄两个成员变量。正确地定义一个student类型的结构体变量的方式是( )
struct student{char name[20];int age;};
A.struct student s; B.struct s=student;
C.student s; D.student=struct s;
【答案】A
19.下列代码片段中,声明了一个名为point的结构体,其中包含了x和y两个成员变量。正确地给point类型的结构体变量赋值的选项为( )
struct point{int x;int y;};
A.point p;p.x=1;p.y=2; B.point p={1,2};
C.struct point p;p.x=1;p.y=2; D.struct point p={1,2};
【答案】D
20.执行以下程序的输出结果是( )
main()
{struct abc{int x;int y;}a[2]={{1,2},{3,4}};
printf("%d",a[0].y+a[0].x);getch();}
A.1 B.2 C.3 D.4
【答案】C
二、程序运行结果题(共5小题,每小题4分,共20分)
21.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
main()
{union ex{struct{int x;int y;}in;
int a;int b;}e;
e.a=1;e.b=2;e.in.x=e.a*e.b;
e.in.y=e.a+e.b;
printf("%d,%d",e.in.x,e.in.y);getch();}
【答案】4,8
22.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct aa{int a;int *b;}s[3],*p;
main()
{int n=3,i;
for(i=1;i<3;i++)
{s[i].a=n+1;
s[i].b=&s[i].a;
p=s,n++,p++;}
printf("%d",++p->a);
getch();}
【答案】5
23.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct book{char title[50];int pages;};
main()
{struct book book1={"C programming",500};
struct book book2;
book2=book1;
printf("book 2 title:%s
",book2.title);
printf("book 2 pages:%d
",book2.pages);getch();}
【答案】
book 2 title:C programming
book 2 pages:500
24.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct Circle{float radius;};
float calculateArea(struct Circle c)
{return 3.14*c.radius*c.radius;}
main()
{struct Circle c1={5.0};
printf("Area of the circle:%.2f
",calculateArea(c1));
getch();}
【答案】Area of the circle:78.50
25.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct point{int x;int y;};
main()
{struct point p1={20,23};
struct point p2={20,24};
struct point sum;
sum.x=p1.x+p2.x;
sum.y=p1.y+p2.y;
printf("Sum of points:(%d,%d)
",sum.x,sum.y);
getch();}
【答案】Sum of points:(40,47)
26.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct emplyee{char name[50];int employee_id;float salary;};
main()
{struct emplyee emp1={"Laowen",2025,1234.50};
struct emplyee emp2={"xiaomei",1002,5678.75};
printf("%s,%d,%.2f
",emp1.name,emp1.employee_id,emp1.salary);
printf("%s,%d,%.2f
",emp2.name,emp2.employee_id,emp2.salary);
getch();}
【答案】
Laowen,2025,1234.50
xiaomei,1002,5678.75
三、程序填空题(共1小题,每空4分,合计20分)
27. 下列程序的主函数中,通过函数调用把N个人的姓名与温度数据放入-一个带头节点的链表中,h指向链表的头节点。函数Check()的功能是:找出体温大于37.5的结点(除头结点外),并显示相关信息。请补充程序,使其完整。
#include <stdio.h>
#include<conio.h>
#include<malloc.h>
#define N 5
typedef struct ss
{char name[8];/*姓名*/
float t; /*温度*/
【1】;
}NODE;
void Check (NODE *h) /*把温度大于37.5的结点信息显示出来*/
{int sum=0;
【2】;
p=h->next;
while(p!=NULL)
{if(【3】)
printf("%s,%3.1f
",p->name,p->t);
p=p->next;}}
NODE *creatlist(int n)/*创建链表*/
{NODE *h,*p,*s;
int i;float temp;
h=p=(NODE*)malloc(sizeof(NODE));
for(i=1;i<n;i++)
{s=(NODE*)malloc(sizeof(NODE));
printf("input name=");
scanf("%s",s->name);
printf("input t=");
scanf("%f",&temp);
s->t=temp;
s->next=p;
【4】;
p=p->next;}
【5】;
return h;}
void OutList(NODE *h)/*输出链表*/
{NODE *p;
p=h->next;
printf("
The LIST :
HEAD");
while(p){
printf("->%s,%3.1f",p->name,p->t);
p=p->next;}
printf("
");}
int main(void)
{NODE *head; int sum;
head=creatlist(N);
OutList(head);
Check(head);
getch();}
【答案】①struct ss *next ②NODE *p ③p->t>37.5
④p->next=s ⑤p->next=NULL
原创精品资源学科网独家享有版权,侵权必究!
学科网(北京)股份有限公司
学科网(北京)股份有限公司
$$
编写说明:《计算机应用考纲百套卷》依据湖南省《计算机应用类专业知识考试标准》编写,本套试卷共100份,分为三个部分,第一部分是知识点训练卷,共62份,第二部分是常考题训练卷,共18份,第三个部分是专业综合训练卷,参考历年计算机应用类专业真题试卷,编写了20份。
本试卷是《计算机应用考纲百套卷》的第79卷,是第二部分常考题训练卷,根据考纲进行解读,本试卷的知识要点如下所示:
①结构体、共用体的概念和定义。②链表的定义与建立。③链表的插入、删除等操作。
湖南省《计算机应用考纲百套卷》
《计算机编程语言—C语言》
第79卷
常考题训练卷
时间:45分钟 总分:100分
班级___________ 姓名__________ 学号__________ 成绩________
一、选择题(共20小题,每小题3分,合计60分)
1.下列叙述中错误的是( )
A.可以通过typedef增加新的类型
B.可以用typedef将已存在的类型用一个新的名字来代表
C.用typedef定义新的类型名后,原有类型名仍然有效
D.用typedef可以为各种类型起别名,但不能为变量起别名
2.执行以下程序的输出结果是( )
struct tt
{int n1;char n2;float n3;
union uu{int u1[2];char u2[2];}su;}
main()
{printf("%d",sizeof(struct tt));getch();}
A.11 B.12 C.13 D.20
3.已知学生记录的描述如下所示,设变量s中的“生日”为“1995年2月12日”,下列对“生日”的赋值方式中,正确的是( )
struct student{int no;char name[10];char sex;
struct {int year;int month;int day;}birth;}s;
A. year=1995;month=2;day=12;
B. birth.year=1995;birth.month=2;birth.day=12;
C. s.year=1995;s.month=2;s.day=12;
D. s.birth.year=1995;s.birth.month=2;s.birth.day=12;
4.设有说明语句:struct stu{int a;float b;}stutype;,则下列叙述中不正确的一项是( )
A.struct是结构体类型的关键字 B.struct stu 是用户定义的结构体
C.stutype是用户定义的结构体类型名 D.a和b都是结构体成员名
5.C语言结构体类型变量在程序执行期间( )
A.所有成员一直驻留在内存中 B.只有一个成员驻留在内存中
C.部分成员驻留在内存中 D.没有成员驻留在内存中
6.若有以下定义和语句,则不正确的引用是( )
struct student{int age;int num;}stu[3],*p=stu;
A.(p++)->num B.p++ C.(*p).num D.p=&stu.age
7.下列scanf()函数调用语句中,对结构体变量成员引用不正确的是( )
struct pu{char name[10];int age;char sex;}pup[5],*p=pup;
A. scanf("%s",pup[0].name); B. scanf("%d",&pup[0].age);
C. scanf("%c",&(p->sex)); D. scanf("%d",p->age);
8.设有如下所示的定义语句,若要使p指向data中的n域,则正确的赋值语句是( )
struct sk{int n;float x;}data,*p;
A.p=&data.n; B.*p=data.n;
C.p=(struct sk *)&data.n; D.p=(struct sk *)data.n;
9.执行以下程序的运行结果是( )
struct stu{int x;int *y;}*p;int dt[4]={10,20,30,40};
struct stu a[4]={50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]};
main()
{p=a;printf("%d,",++p->x);
printf("%d,",(++p)->x);
printf("%d",++(*p->y));getch();}
A.10,20,20 B.50,60,21 C.51,60,21 D.60,70,31
10.下列关于C语言中共用体类型数据的叙述中,正确的一项是( )
A.可以对共用体变量名直接赋值
B.一个共用体变量中可以同时存放其所有成员
C.一个共用体变量中不能同时存放其所有成员
D.共用体类型定义中不能出现结构类型的成员
11.执行以下程序的输出结果是( )
union pw{int i;char ch[2];}a;
main()
{a.ch[0]=13;a.ch[1]=1;
printf("%d",a.i);getch();}
A.13 B.14 C.268 D.269
12.( )
A.B.C.D.
13.设有定义:char s[7][8],(*k)[6],*p;,则以下赋值语句中正确的是( )
A.p=s; B.p=k; C.p=s[1]; D.k=s;
14.结构体在C语言中用来( )
A.定义变量 B.定义函数 C.定义数据类型 D.定义数组
15.下列关于结构体的描述中错误的是( )
A.结构体可以包含不同数据类型的成员
B.结构体变量占用连续的内存空间
C.结构体可以作为函数的参数和返回值
D.结构体可以嵌套定义
16.在C语言中,结构体的成员可以通过( )方式访问
A.点号运算符(.) B.星号运算符(*)
C.换行符(
) D.逗号(,)
17.下列选项中最准确地描述了C语言结构体的定义方式的是( )
A.struct{int x;float y;}s; B.struct(int x,float y);
C.struct s{int x;int y}; D.struct{int x,float y}s;
18.下列代码片段中,声明了一个名为student的结构体,其中包含了姓名和年龄两个成员变量。正确地定义一个student类型的结构体变量的方式是( )
struct student{char name[20];int age;};
A.struct student s; B.struct s=student;
C.student s; D.student=struct s;
19.下列代码片段中,声明了一个名为point的结构体,其中包含了x和y两个成员变量。正确地给point类型的结构体变量赋值的选项为( )
struct point{int x;int y;};
A.point p;p.x=1;p.y=2; B.point p={1,2};
C.struct point p;p.x=1;p.y=2; D.struct point p={1,2};
20.执行以下程序的输出结果是( )
main()
{struct abc{int x;int y;}a[2]={{1,2},{3,4}};
printf("%d",a[0].y+a[0].x);getch();}
A.1 B.2 C.3 D.4
二、程序运行结果题(共5小题,每小题4分,共20分)
21.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
main()
{union ex{struct{int x;int y;}in;
int a;int b;}e;
e.a=1;e.b=2;e.in.x=e.a*e.b;
e.in.y=e.a+e.b;
printf("%d,%d",e.in.x,e.in.y);getch();}
22.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct aa{int a;int *b;}s[3],*p;
main()
{int n=3,i;
for(i=1;i<3;i++)
{s[i].a=n+1;
s[i].b=&s[i].a;
p=s,n++,p++;}
printf("%d",++p->a);
getch();}
23.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct book{char title[50];int pages;};
main()
{struct book book1={"C programming",500};
struct book book2;
book2=book1;
printf("book 2 title:%s
",book2.title);
printf("book 2 pages:%d
",book2.pages);getch();}
24.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct Circle{float radius;};
float calculateArea(struct Circle c)
{return 3.14*c.radius*c.radius;}
main()
{struct Circle c1={5.0};
printf("Area of the circle:%.2f
",calculateArea(c1));
getch();}
25.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct point{int x;int y;};
main()
{struct point p1={20,23};
struct point p2={20,24};
struct point sum;
sum.x=p1.x+p2.x;
sum.y=p1.y+p2.y;
printf("Sum of points:(%d,%d)
",sum.x,sum.y);
getch();}
26.执行以下程序的输出结果是( )
#include <stdio.h>
#include<conio.h>
struct emplyee{char name[50];int employee_id;float salary;};
main()
{struct emplyee emp1={"Laowen",2025,1234.50};
struct emplyee emp2={"xiaomei",1002,5678.75};
printf("%s,%d,%.2f
",emp1.name,emp1.employee_id,emp1.salary);
printf("%s,%d,%.2f
",emp2.name,emp2.employee_id,emp2.salary);
getch();}
三、程序填空题(共1小题,每空4分,合计20分)
27. 下列程序的主函数中,通过函数调用把N个人的姓名与温度数据放入-一个带头节点的链表中,h指向链表的头节点。函数Check()的功能是:找出体温大于37.5的结点(除头结点外),并显示相关信息。请补充程序,使其完整。
#include <stdio.h>
#include<conio.h>
#include<malloc.h>
#define N 5
typedef struct ss
{char name[8];/*姓名*/
float t; /*温度*/
【1】;
}NODE;
void Check (NODE *h) /*把温度大于37.5的结点信息显示出来*/
{int sum=0;
【2】;
p=h->next;
while(p!=NULL)
{if(【3】)
printf("%s,%3.1f
",p->name,p->t);
p=p->next;}}
NODE *creatlist(int n)/*创建链表*/
{NODE *h,*p,*s;
int i;float temp;
h=p=(NODE*)malloc(sizeof(NODE));
for(i=1;i<n;i++)
{s=(NODE*)malloc(sizeof(NODE));
printf("input name=");
scanf("%s",s->name);
printf("input t=");
scanf("%f",&temp);
s->t=temp;
s->next=p;
【4】;
p=p->next;}
【5】;
return h;}
void OutList(NODE *h)/*输出链表*/
{NODE *p;
p=h->next;
printf("
The LIST :
HEAD");
while(p){
printf("->%s,%3.1f",p->name,p->t);
p=p->next;}
printf("
");}
int main(void)
{NODE *head; int sum;
head=creatlist(N);
OutList(head);
Check(head);
getch();}
原创精品资源学科网独家享有版权,侵权必究!
学科网(北京)股份有限公司
学科网(北京)股份有限公司
$$