第9章 结构体
1.定义以下结构体类型 struct s {
int a; char b; float f; };
则语句printf(\的输出结果为【 】。 A) 3 B) 7 C) 6 D) 4
2.当定义一个结构体变量时,系统为它分配的内存空间是【 】 A)结构中一个成员所需的内存容量 B)结构中第一个成员所需的内存容量
C)结构体中占内存容量最大者所需的容量 D)结构中各成员所需内存容量之和
3.定义以下结构体类型 struct s { int x; float f; }a[3];
语句printf(\的输出结果为 【 】 A) 4 B) 12 C) 18 D) 6
4.定义以下结构体数组 struct c { int x; int y;
}s[2]={1,3,2,7};
语句printf(\的输出结果为 【 】 A) 14 B) 6 C) 2 D) 21
5.运行下列程序段,输出结果是 【 】 struct country { int num;
char name[10];
}x[5]={1,\ struct country *p; p=x+2;
printf(\ A) 3,a B) 4,g C) 2,U D) 5,S
6.下面程序的运行结果是【 】。 struct KeyWord {
char Key[20]; int ID;
}kw[]={\main() {
printf(\}
A) i,3 B) n,3 C) f,4 D) l,4
7.定义以下结构体类型 struct student {
char name[10];
int score[50]; float average; }stud1;
则stud1占用内存的字节数是【 】。
A) 64 B) 114 C) 228 D) 7
8.如果有下面的定义和赋值,则使用【 】不可以输出n中data的值。 struct SNode {
unsigned id; int data; }n,*p; p=&n;
A) p.data B) n.data C) p->data D) (*p).data
9.根据下面的定义,能输出Mary的语句是【】。 struct person {
char name[9]; int age; };
struct person class[5]={\
A) printf(\B) printf(\C) printf(\
D) printf(\
10.定义以下结构体数组 struct date { int year; int month; int day; }; struct s
{ struct date birthday; char name[20];
} x[4]={{2008, 10, 1, \语句
printf(\的输出结果为 【 】。 A) guangzhou,2009 B) guangzhou,2008 C) Tianjin,2008 D) Tianjin,2009
11.运行下列程序段,输出结果是【】。 struct country { int num;
char name[20];
}x[5]={1, \ struct country *p; p=x+2;
printf(\
A) 2,France B) 3,France C) 4,England D) 3, China
12. 定义以下结构体数组 struct {
int num;
char name[10];
}x[3]={1,\
语句printf(\的输出结果为【 】 A)2,USA B)3,England C)1,china D)2,England
13. 定义以下结构体数组
struct date {
int year; int month;
};
struct s {
struct date birth; char name[20];
}x[4]={{2008,8,\
语句printf(\的输出结果为【 】 A)a,2008 B)hangzhou,2008 C)i,2009 D)Tianjin,2009
14. 运行下列程序,输出结果是【 】
struct contry {
int num;
char name[20];
}x[5]={1,\main() {
int i;
for (i=3;i<5;i++)
printf(\}
A)3F4E5S B)4E5S C)F4E D)c2U3F4E
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C语言结构体习题及答案在线全文阅读。
相关推荐: