p=a; q=a+4;
while(p++ A.15 24 33 B.15 24 C.24 33 D.24 1729、以下程序段的运行结果是( D )。 #include t.str[0]='a'; t.str[1]='b'; t.n=65; printf(\} A.65 ab B.65 a C.97 ab D.65 A 1730、以下叙述中错误的是( B )。 A.一个结构体变量占用的内存大小是各成员所需内存容量之和 B.一个联合体变量占用的内存大小是各成员所需内存容量之和 C.联合体类型可以出现在结构体类型定义中 D.结构数组是数据元素为结构体类型的数组 1731、针对以下定义,变量t1所占用的内存字节数是( D )。struct birthday { int year; int month; int day; }; struct teacher { char num[10]; char name[8]; char sex; struct birthday birth; }t1; A.10 B.21 C.23 D.25 1732、以下程序运行的结果是( C )。 #include {printf(%u)); } A.4 B.7 C.12 D.21 9 1733、针对以下定义,能输出字母'Y'的语句是( A )。 struct class {char name[8]; int age; }; struct class s[12]={\ A.printf(\C.printf(\ 1829、针对以下定义,已建立如图所示的链表,指针head指向链表的首结点。能输出所有结点的data值的语句是( C )。 struct node { int data; struct node *next; }; struct node *head,*p; A.p=head; while(p) { printf(\ p++; } B.p=head; while(p) { printf(\ p=p->next; } C.p=head; for( ; p; p=p->next) printf(\D.p=head; for( ; p; p++) printf(\ 1830、针对以下定义,已建立如图所示的链表,指针head指向链表的首结点。能删除指针链表第二个结点的程序段是( A )。 struct node { int data; struct node *next; }struct node *head,*p; A.p = head->next; head->next=p->next; free(p); B.head->next=head->next->next; p=head->next; free(p); C.p=head; head->next = p->next; 10 free(p); D.p=head->next->next; head->next = p->next; free(p); 1831、针对以下定义,已建立如图所示的链表,指针head指向链表的首结点。以下函数的功能是( C )。 struct node { int data; struct node *next; }; void fun(struct node * head) { struct node * p = head; while(p->next) { printf(\ p = (*p).next; } } A.逐个输出链表中的所有数据 B.输出链表第一个结点的数据 C.逐个输出链表中除最后一个结点外的所有数据 D.逐个输出链表中除第一个结点外的所有数据 1832、针对以下定义,已建立如图所示的链表,指针head指向链表的首结点。函数link的功能是( C )。 struct node {int data; struct node *next; }; int link(struct node* head) { int k=0; struct node *p=head; while(p) { p=p->next; k++; } return k; } A.输出链表head中所有结点 B.在链表head的最后插入一个新元素 C.函数的返回值是链表head中的结点数 D.删除链表head的最后一个元素 1833、针对以下定义,已建立如图所示的链表,指针head指向链表的首结点。函数link的功能是( B )。 struct node {int data; struct node *next; }; float link(struct node *head) 11 { int m=0,n=0; struct node *p=head; while(p) { m+=p->data; n++; p=p->next; } if(n>0) return 1.0*m/n; else return 0; } A.函数的返回值是链表head中的结点数 B.函数的返回值是链表head中各结点成员data的平均值 C.函数的返回值是链表head中各结点成员data的的总和 D.创建一个新链表head 1929、下列枚举类型定义语句中错误的是( B )。 A.enum car {A, B, C}; B.enum car {0, A, C}; C.enum car {X, Y=5, Z}; D.enum car {D=3, E, F=10}; 1930、若有定义:typedef int INTEGER; INTEGER p,*q; 则下列叙述正确的是( A )。A.程序中可用INTEGER定义整型变量 B.不能用INTEGER来定义变量 C.p,q都是int型变量 D.p,q都是基类型为int的指针变量 1931、以下程序段运行后变量k的值为( D )。 int m=16,n=3,k;k=(m|n)>>1; A.1 B.38 C.13 D.9 1932、以下程序运行的结果是( A )。 #include {enum Weekday{sun=7,mon=1,tue,wed,thu,fri,sat}; printf(\ A.2 B.3 C.8 D.9 1933、以下程序段运行的结果是( C )。 int p=7,q=6; printf(\ A.4 B.5 C.6 D.7 2029、若执行fopen函数时发生错误,则函数的返回值是( B )。 A.EOF B.0 C.1 D.文件指针的当前地址 2030、文件操作的一般步骤是( D )。 A.打开文件,定义文件指针,读写文件 B.打开文件,定义文件指针,读写文件,关闭文件 C.定义文件指针,定位指针,读写文件 D.定义文件指针,打开文件,读写文件,关闭文件 2031、若用fgetc函数从指定文件中读入一个字符,该文件的打开方式可以是( D )。 A.只读方式 B.读写方式 C.追加方式 D.只读或读写方式 2032、下列叙述错误的是( C )。 A.可以通过库函数fseek()、ftell()和rewind()移动文件指针的位置 B.可以以只读方式、只写方式或读写方式打开一个文本文件 C.可以用EOF判断文本文件和二进制文件是否结束 D.当对文件的写操作完成之后,必须将它关闭,否则可能导致数据丢失 12 13
相关推荐: