一、?选择题1、?定义结构类型时,下列叙述正确的是A、?系统会按成员大小分配每个空间B、?系统会按最大成员大小分配空间C、?系统不会分配空间D、?以上说法均不正确2、已知结构类型变量x的初始化值为{“20”,30,40,35.5},请问合适的结构定义是A、?Struct s{int no;int x,y,z};B、?Struct s{char no[2];int x,y,z};C、?Struct s{int no;float x,y,z}; D、Struct s{char no[2];float x,y,z};3、若程序中有定义struct abc{int x;char y;};abc s1,s2;则会发生的情况是A、?编译时会有错误B、?链接时会有错误C、?运行时会有错误D、?程序没有错误
struct student
{int no;
char name[20];
char set;
struct
{int year;
int month;
int day;
}birth;};
struct student s;
设变量s中的“生日”应是“1984年11月11日”,下列对生日的正确赋值方式是( ).
A)year=1984; B)birth.year=1984;
month=11; birth.month=11;
day=11; birth.day=11;
C)s.year=1984; D)s.birth.year=1984;
s.month=11; s.birth.month=11;
s.day=11; s.birth.day=11;
5、当说明一个结构体变量时系统分配给它的内存是( ).
A)各成员所需内存量的总和 B)结构中第一个成员所需内存量
C)成员中占内存量最大者所需的容量 D)结构中最后一个成员所需内存量
6、以下对结构体类型变量的定义中不正确的是( ).
A)#define STUDENT struct student B)struct student
STUDENT {int num;
{int num; float age;
float age; }std1;
}std1;
C)struct D)struct
{int num; int num;
float age; float age;
}std1; }student;
struct student std1;
7、设有以下说明语句
struct stu
{int a;
float b;
}stutype;
则下面的叙述不正确的是( ).
A)struct是结构体类型的关键字
B)struct stu是用户定义的结构体类型
C)stutype是用户定义的结构体类型名
D)a和b都是结构体成员名
8、C语言结构体类型变量在程序执行期间( )..
A)所有成员一直驻留在内存中
B)只有一个成员驻留在内存中
C)部分成员驻留在内存中
D)没有成员驻留在内存中
9、在16位IBM-PC机上使用C语言,若有如下定义:
struct data
{int i;
char ch;
double f;
}b;
则结构变量b占用内存的字节数是( ).
A)1 B)2 C)3 D)4
10、以下程序的运行结果是( ).
#include “stdio.h”
main()
{struct data
{int year,month,day;
}today;
printf(“%d\n”,sizeof(struct data));}
A)6 B)8 C)10 D)12
11、若有以下定义和语句;
????????struct student??????????
{int age;????????????
int num ;};
struct