一、 单选题 (每小题10分,共100分,得分 90 分) 1、有关宏定义的正确说明是_____。
A、可出现在一行中的任何位置
B、只能放在程序的开头,且每一个宏定义单独占一行
C、可出现在程序的任何位置
D、以#开头的行,可出现在程序的任何位置,通常每一个宏定义只能单独占一行,使用字符“\\”可实现一个宏定义占用若干行
你的回答: D (√) 参考答案:D
2、结构是C语言的构造数据类型。下面定义了一个职工结构employee、结构变量emp1和结构指针变量p:
struct employee{
int num; //职工编号 char name[10]; //职工姓名 }emp1,*p; p=&emp1;
正确使用结构变量emp1的语句是: A、scanf(\ B、scanf(\ C、scanf(\ D、scanf(\
你的回答: A (√) 参考答案:A
3、下面定义了一个通信录结构friends_list、结构变量friend1 struct friends_list{
int num; //编号 char name[10]; //姓名 char telephone[13]; //电话 int age; //年龄 }friend1;
正确使用结构变量friend1的语句是 A、friend1.name=\ B、friend1->name=\ C、 D、
你的回答: A (√) 参考答案:
4、下面定义了一个通信录结构friends_list、结构变量friend1 struct friends_list{
int num; //编号 char name[10]; //姓名 char telephone[13]; //电话 int age; //年龄 }friend1;
正确使用结构变量friend1的语句是 A、friend1.name=\ B、friend1->name=\ C、strcpy(friend1.name,\ D、strcpy(friend1->name,\
你的回答: C (√) 参考答案:C
5、下面定义了一个通信录结构friends_list、结构变量friend1 struct friends_list{
int num; //编号 char name[10]; //姓名 char telephone[13]; //电话
int age; //年龄 }friend1;
正确使用结构变量friend1的scanf语句是
A、sacnf(\ B、sacnf(\ C、sacnf(\ D、sacnf(\
你的回答: B (√) 参考答案:B
6、5、下面定义了一个日期结构date、结构变量date1和date2 struct date{ int year; int month; int day;
}date1={2000,1,1},date2;
对结构变量date2正确操作的语句是 A、date2=date1;
B、strcpy(date2,date1); C、date2={2010,12,1}; D、date2={2010-12-1};
你的回答: A (√) 参考答案:A
7、下面定义了一个日期结构struct date struct date{ int year; int month; int day; }date1;
结构类型占用的内存空间可用sizeof来计算,正确的sizeof格式是 A.sizeof(date1) B.sizeof(struct date) C.sizeof(struct date date1) D.sizeof(date) A、A正确 B、B正确 C、A和B都正确 D、C和D都正确
你的回答: C (√) 参考答案:C
8、下面定义了一个日期结构struct date struct date{ int year; int month; int day;
}date1;
该结构类型占用的内存空间是多少字节 A、6 B、9 C、12 D、15
你的回答: C (√) 参考答案:C
9、下面定义了一个平面点结构struct point、结构变量point1和结构指针p struct point{ double x;
double y;
}point1,*p=&point1;
欲将点(100,100)赋值给point1,则不正确的操作语句是
A、point1.x=100;point1.y=100; B、*p.x=100;*p.point1.y=100; C、(*p).x=100;(*p).point1.y=100; D、p->x=100;p->y=100;
你的回答: B (√) 参考答案:B
10、关于嵌套结构的定义描述,正确的是:
A、在定义嵌套的结构类型时,必须先定义成员的结构类型,再定义主结构类型 B、在定义嵌套的结构类型时,必须先定义主结构类型,再定义成员的结构类型 C、在定义嵌套的结构类型时,成员的结构类型和主结构类型的先后顺序无关紧要 D、以上描述都不正确
你的回答: A (√) 参考答案:A