第八章测试
1.

有如下结构体定义,能够正确引用结构体的是()。

struct student

{

long num;

char name[10];

char sex;

int age;

float score;

}stu;



A:

stu->sex=’f’ 

B:

stu=”lili”

C:

stu.num=”40012120”

D:

stu.age=20


答案:D
2.

有以下程序段,输出结果为()。

#include <stdio.h>   

  struct  s

{  int  a;

  char  b;

  double  f;

};  

  main()   

{ printf("%d",sizeof(struct  s));

 }




A:

12

B:

16

C:

13

D:

24

3.

有以下程序段,输出结果为()。

#include<stdio.h>

struct person

{char name[20];

int count;

}leader[3]={"Li",0,"Zhang",0,"Sun",0};

main()

{printf("%s",leader[1].name);

}




A:

0

B:

Li    

C:

sun  

D:

Zhang  

4.

有以下程序段,输出结果为()。

#include<stdio.h>

struct student

{int num;

char name[20];

float score;

};

main()

{struct student stu[5];

printf("%d",sizeof(stu));

}




A:

随机值

B:

160

C:

140

D:

5

5.

以下程序段,在空白处填写()能使程序正确运行并输出结果。

#include<stdio.h>

struct student

{long num;

char name[10];

char sex;

float score;

};

main()

{struct student stu={10101,"lili",'m',89.5},*pt;

             

printf("%.2f",pt->score);

}



A:

pt=stu;  

B:

*pt=&stu;

C:

pt=&stu;   

D:

*pt=stu;     

6.

有结构体声明如下,成员next是一个指针,指向对象的类型是()。

struct node

{

char ch;

struct node *next;

};




A:

int      

B:

char   

C:

node

D:

float       

7.

有以下共用体声明,赋值错误的是()。

union data

{

int i;

char ch;

float f;

}


A:

union data a;a.i=97;     

B:

union data a={97};         

C:

union data a={97,'b',1.5};    

D:

union data a;a.i=’a’;   

8.

以下程序段的运行结果为()。

#include<stdio.h>

union data

{

int i;

char ch;

float f;

};

main()

{union data a;

a.i=98;

a.ch='B';

printf("%d",a.i);

}




A:

66

B:

0

C:

98

D:

随机值

9.

有枚举定义enum sex{m,f} stu;能够正确赋值的是()。




A:stu=man     B:stu={m,f}          C:stu=f    D:stu=nan 10.

有新类型名声明typedef int Num[10];以下各项中与int a[10]含义相同的是()。


A:

Num a      

B:

Num a[10] 

C:

typedef a

D:

typedef a[10]   

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(165) dxwkbang
返回
顶部