- 68
- 0
- 约3.61千字
- 约 4页
- 2021-10-12 发布于陕西
- 举报
第9章 结构体(练习题OK)
第9章 结构体
一、单项选择题
1. 若有以下说明语句: struct student { int num; char name[ ]; float score; }stu;
则下面的叙述不正确的是: ( )
A) struct是结构体类型的关键字 B) struct student 是用户定义的结构体类型 C) num, score都是结构体成员名 D) stu是用户定义的结构体类型名 2. 若有以下说明语句: struct date { int year; int month; int day; }brithday;
则下面的叙述不正确的是_____.
A) struct是声明结构体类型时用的关键字 B) struct date 是用户定义的结构体类型名 C) brithday是用户定义的结构体类型名 D) year,day 都是结构体成员名
3. 已知:(设整型2字节,字符型1字节,浮点型4字节)
struct { int i; char c; float a; }test;
则sizeof(test)的值是 。 A) 4 B) 5 C) 6 D) 7
4. 以下对结构变量stul中成员age的非法引用是 。
struct student { int age; int num; }stu1,*p; p=stu1;
A) stu1.age B) student.age C) p-age D) (*p).age 5. 有如下定义
struct person{char name[9]; int age;}; struct person class[10]={“Tom”,17,“John”,19,
“Susan”,18,“Adam”,16,};
根据上述定义,能输出字母A的语句是
A) printf(“%c\\n”,class[3].name); B) printf(“%c\\n”,class[3].name[0]);
C) printf(“%c\\n”,class[3].name[1]); D) printf(“%c\\n”,class[2].name[3]); 6. 存放100个学生的数据、包括学号、姓名、成绩。在如下的定义中,不正确的是( )。
A.struct student
{int sno; char name[20]; float score; } stu[100];
B. struct student stu[100]
{int sno; char name[20]; float score}; C. struct { int sno; char name[20]; float score;} stu[100]; D. struct student
{int sno; char name[20]; float score;}; struct student stu[100];
7. 设有定义语句“struct {int x; int y;} d[2]={{1,3},{2,7}};” 则“printf(“%d\\n”,d[0].y/d[0].x*d[1].x);”输出的是( )。
A.0 B)1 C)3 D)6 8. 设有如下定义,则对data中的a成员的正确引用是( )。 struct sk{ int a; float b;} data,*p=data;
A)(*p))data.a B)(*p).a C)p-data.a D)p.data.a 9、已知: struct sk { int a;
float b;
}data, *p;
若有p=data,则对data中的成员a的正确引用是( )。 A、(*p).data.a B、p-data.a C、(*p).a D、p.
您可能关注的文档
- 浅谈新课程背景下农村中学班主任如何进行班级管理.docx
- 好段摘抄赏析30字.docx
- 重庆市涪陵区教育公众信息网.docx
- 小学生国防教育作文.docx
- 我会变作文500字.docx
- 2021国家公务员考试面试无领导小组讨论真题全透析.docx
- 《对垒特工》经典观后感10篇.docx
- 冬季校园防火安全知识介绍.docx
- 艺术生实习感言范文.docx
- @@四上语文古诗生字.docx
- 2025-2026学年天津市和平区高三(上)期末数学试卷(含解析).pdf
- 2025-2026学年云南省楚雄州高三(上)期末数学试卷(含答案).pdf
- 2025-2026学年甘肃省天水市张家川实验中学高三(上)期末数学试卷(含答案).docx
- 2025-2026学年福建省厦门市松柏中学高二(上)期末数学试卷(含答案).docx
- 2025-2026学年广西钦州市高一(上)期末物理试卷(含答案).docx
- 2025-2026学年河北省邯郸市临漳县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省石家庄二十三中七年级(上)期末历史试卷(含答案).docx
- 2025-2026学年海南省五指山市九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省唐山市玉田县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省邢台市市区九年级(上)期末化学试卷(含答案).docx
原创力文档

文档评论(0)