C语言程序设计(专)-作业二武汉理工大学20春
C语言程序设计(专)-作业二1.[单选题] 若已定义 int arr;则不能正确引用arr数组元素的是( )。
A.arr
B.arr
C.arr
D.arr
正确答案:——D——
2.[单选题] 以下程序段的运行结果是( )。 int a[]={1,2,3,4},i,j; j=1; for(i=3;i>=0;i--) { a=a*j; j=j*3; } for(i=0;i<4;i++) printf("%d",a);
A.3 6 9 12
B.18 12 9 4
C.27 18 9 4
D.54 18 9 4
正确答案:——C——
3.[单选题] 下面关于C语言变量的叙述中,错误的是( )。
A.可以用define关键字定义变量
B.变量名用大小写字母是有区别的
C.C语言允许不同基本类型的变量之间进行混合运算
D.C语言中要求对变量作强制定义的主要理由是:便于确定类型和分配空间
正确答案:——A——
4.[单选题] 设有结构体的定义如下: struct data{ int n; char c; float f; }; 则sizeof (struct data)的值是( )
A.1
B.3
C.7
D.11
正确答案:————
5.[单选题] 若有定义: int i,x=0; 语句for(i=1;i<=3;i++) x+=2;与下列( )程序段不等价。
A.i=1;for( ;i<=3;i++) x+=2;
B.i=1;for( ; ;i++) x+=2;
C.for(i=1;i<=3; ){x+=2; i++;}
D.i=1;for( ;i<=3; ) {x+=2; i++; }
正确答案:————
6.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_65" o:spid="_x0000_i1087" type="#_x0000_t75" style='width:224.4pt;height:35.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image065.png" o:title=""/></v:shape><!--><!----><img width="299" height="47" v:shapes="图片_x0020_65" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image065.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><span style="color:white"> <o:p></o:p></span></span></p>
A.6
B.0
C.1
D.5
正确答案:————
7.[单选题] 若有以下定义: struct node { int data; struct node *next; } *p,*q; 已建立如下图所示的链表: ┌──┬──┐┌──┬──┐ ... p →│data│next┼→│data│NULL│ └──┴──┘└──┴──┘ ┌──┬──┐ q →│data│next│ └──┴──┘ 不能将指针q所指结点连到上图所示链表末尾的语句是( )。
A.q->next=NULL; p=p->next; p->next=q;
B.p=p->next; p->next=q; q->next=NULL;
C.p=p->next; q->next=p->next; p->next=q;
D.q->next=p->next; p=p->next; p->next=q;
正确答案:————
8.[单选题] C语言中,错误的int类型的常数是( )
A.1E5
B.0
C.037
D.0xaf
正确答案:————
9.[单选题] 以下程序段运行后变量k的值为( )。 int m=7,n=2,k;k=(m^n)<<1;
A.0
B.98
C.20
D.10
正确答案:————
10.[单选题] ( )是正确的叙述。
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_37" o:spid="_x0000_i1061" type="#_x0000_t75" style='width:111pt;height:18pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image039.png" o:title=""/></v:shape><!--><!----><img width="148" height="24" v:shapes="图片_x0020_37" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image039.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_38" o:spid="_x0000_i1062" type="#_x0000_t75" style='width:78pt;height:18.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image040.png" o:title=""/></v:shape><!--><!----><img width="104" height="25" v:shapes="图片_x0020_38" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image040.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_39" o:spid="_x0000_i1063" type="#_x0000_t75" style='width:75.6pt;height:21pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image041.png" o:title=""/></v:shape><!--><!----><img width="101" height="28" v:shapes="图片_x0020_39" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image041.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_40" o:spid="_x0000_i1064" type="#_x0000_t75" style='width:1in;height:23.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image042.png" o:title=""/></v:shape><!--><!----><img width="96" height="31" v:shapes="图片_x0020_40" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image042.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
正确答案:————
11.[单选题] 若有以下定义: struct node { int data; struct node *next; } struct node *p; 已建立如下图所示的链表: ┌──┬──┐ ┌──┬──┐ ┌──┬──┐ p→│data│next┼ →│data│next┼ →...→│data│NULL│ └──┴──┘ └──┴──┘ └──┴──┘ 指针p指向第一个结点,能输出链表所有结点的数据成员data的循环语句是( )。
A.while(p!=NULL) { printf("%d,",p->data); p++;}
B.while(p) { printf("%d,", p.data); p=p->next;}
C.for( ; p!=NULL; p++) printf("%d,", p->data);
D.for( ; p; p=p->next) printf("%d,", (*p).data);
正确答案:————
12.[单选题] 若已定义 int m=7;float k=5.5; 则表达式 k+ m%2/4 的值为( )。
A.6.375
B.6.75
C.5.75
D.5.5
正确答案:————
13.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_35" o:spid="_x0000_i1058" type="#_x0000_t75" style='width:352.8pt;height:20.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image035.png" o:title=""/></v:shape><!--><!----><img width="470" height="27" v:shapes="图片_x0020_35" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image035.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><span style="color:white"> <o:p></o:p></span></span></p>
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_36" o:spid="_x0000_i1059" type="#_x0000_t75" style='width:23.4pt;height:11.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image036.png" o:title=""/></v:shape><!--><!----><img width="31" height="15" v:shapes="图片_x0020_36" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image036.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_37" o:spid="_x0000_i1060" type="#_x0000_t75" style='width:47.4pt;height:13.8pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image037.png" o:title=""/></v:shape><!--><!----><img width="63" height="18" v:shapes="图片_x0020_37" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image037.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_38" o:spid="_x0000_i1061" type="#_x0000_t75" style='width:39pt;height:21.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image038.png" o:title=""/></v:shape><!--><!----><img width="52" height="29" v:shapes="图片_x0020_38" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image038.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_39" o:spid="_x0000_i1062" type="#_x0000_t75" style='width:44.4pt;height:17.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image039.png" o:title=""/></v:shape><!--><!----><img width="59" height="23" v:shapes="图片_x0020_39" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image039.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
正确答案:————
14.[单选题] <p class="MsoNormal"><span lang="EN-US"><!--><v:shape id="图片_x0020_145" o:spid="_x0000_i1168" type="#_x0000_t75" style='width:183.6pt;height:120.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image148.png" o:title=""/></v:shape><!--><!----><img width="245" height="161" v:shapes="图片_x0020_145" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image148.png"><!----></span></p>
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_146" o:spid="_x0000_i1169" type="#_x0000_t75" style='width:14.4pt;height:18.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image149.png" o:title=""/></v:shape><!--><!----><img width="19" height="25" v:shapes="图片_x0020_146" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image149.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_147" o:spid="_x0000_i1170" type="#_x0000_t75" style='width:15.6pt;height:14.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image150.png" o:title=""/></v:shape><!--><!----><img width="21" height="19" v:shapes="图片_x0020_147" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image150.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_148" o:spid="_x0000_i1171" type="#_x0000_t75" style='width:22.2pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image151.png" o:title=""/></v:shape><!--><!----><img width="30" height="22" v:shapes="图片_x0020_148" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image151.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_149" o:spid="_x0000_i1172" type="#_x0000_t75" style='width:118.8pt;height:17.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image152.png" o:title=""/></v:shape><!--><!----><img width="158" height="23" v:shapes="图片_x0020_149" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image152.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
正确答案:————
15.[单选题] 若有定义:int a,b; float x,则以下不符合C语言语法的表达式是( )。
A.x%7
B.x/=a-b
C.a=b=2
D.x=(float)a/b
正确答案:————
16.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_68" o:spid="_x0000_i1091" type="#_x0000_t75" style='width:272.4pt;height:18pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image070.png" o:title=""/></v:shape><!--><!----><img width="363" height="24" v:shapes="图片_x0020_68" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image070.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><o:p></o:p></span></p>
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_69" o:spid="_x0000_i1092" type="#_x0000_t75" style='width:350.4pt;height:18.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image071.png" o:title=""/></v:shape><!--><!----><img width="467" height="25" v:shapes="图片_x0020_69" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image071.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_70" o:spid="_x0000_i1093" type="#_x0000_t75" style='width:415.2pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image072.png" o:title=""/></v:shape><!--><!----><img width="554" height="22" v:shapes="图片_x0020_70" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image073.jpg"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_71" o:spid="_x0000_i1094" type="#_x0000_t75" style='width:389.4pt;height:19.8pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image074.png" o:title=""/></v:shape><!--><!----><img width="519" height="26" v:shapes="图片_x0020_71" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image074.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_72" o:spid="_x0000_i1095" type="#_x0000_t75" style='width:353.4pt;height:17.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image075.png" o:title=""/></v:shape><!--><!----><img width="471" height="23" v:shapes="图片_x0020_72" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image075.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
正确答案:————
17.[单选题] 下面叙述正确的是( )。
A.程序中必须包含有输入语句
B.变量按所定义的类型存放数据
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_26" o:spid="_x0000_i1050" type="#_x0000_t75" style='width:157.8pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image027.png" o:title=""/></v:shape><!--><!----><img width="210" height="22" v:shapes="图片_x0020_26" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image027.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.每行只能写一条语句
正确答案:————
18.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_104" o:spid="_x0000_i1127" type="#_x0000_t75" style='width:329.4pt;height:18pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image107.png" o:title=""/></v:shape><!--><!----><img width="439" height="24" v:shapes="图片_x0020_104" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image107.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><o:p></o:p></span></p>
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_105" o:spid="_x0000_i1128" type="#_x0000_t75" style='width:60.6pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image108.png" o:title=""/></v:shape><!--><!----><img width="81" height="22" v:shapes="图片_x0020_105" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image108.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_106" o:spid="_x0000_i1129" type="#_x0000_t75" style='width:74.4pt;height:13.8pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image109.png" o:title=""/></v:shape><!--><!----><img width="99" height="18" v:shapes="图片_x0020_106" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image109.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_107" o:spid="_x0000_i1130" type="#_x0000_t75" style='width:38.4pt;height:18pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image110.png" o:title=""/></v:shape><!--><!----><img width="51" height="24" v:shapes="图片_x0020_107" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image110.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_108" o:spid="_x0000_i1131" type="#_x0000_t75" style='width:67.8pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image111.png" o:title=""/></v:shape><!--><!----><img width="90" height="22" v:shapes="图片_x0020_108" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image111.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
正确答案:————
19.[单选题] 以下程序的运行结果是( )。 main() {int a={1,2,3}; int *num; int **p,i; for(i=0;i<3;i++) num=&a; p=num; printf("%d",**p);}
A.1
B.3
C.&a
D.num
正确答案:————
20.[单选题] 若有定义:int x=10,y=8,a; 则执行语句a=((--x==y)? x: y);后,变量a的值是( )。
A.8
B.9
C.10
D.0
正确答案:————
21.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_29" o:spid="_x0000_i1052" type="#_x0000_t75" style='width:263.4pt;height:20.4pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image029.png" o:title=""/></v:shape><!--><!----><img width="351" height="27" v:shapes="图片_x0020_29" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image029.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><span style="color:white"> <o:p></o:p></span></span></p>
A.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_30" o:spid="_x0000_i1053" type="#_x0000_t75" style='width:69pt;height:19.8pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image030.png" o:title=""/></v:shape><!--><!----><img width="92" height="26" v:shapes="图片_x0020_30" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image030.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_31" o:spid="_x0000_i1054" type="#_x0000_t75" style='width:75.6pt;height:16.2pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image031.png" o:title=""/></v:shape><!--><!----><img width="101" height="22" v:shapes="图片_x0020_31" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image031.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_32" o:spid="_x0000_i1055" type="#_x0000_t75" style='width:78.6pt;height:19.8pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image032.png" o:title=""/></v:shape><!--><!----><img width="105" height="26" v:shapes="图片_x0020_32" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image032.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
D.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_33" o:spid="_x0000_i1056" type="#_x0000_t75" style='width:80.4pt;height:18pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image033.png" o:title=""/></v:shape><!--><!----><img width="107" height="24" v:shapes="图片_x0020_33" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image033.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><span style="color:white"> <o:p></o:p></span></span></p>
正确答案:————
22.[单选题] 若有定义:int x,a; 赋值语句a=(x%3==0)?0:1; 与( )语句不等价。
A. if (x%3!=0) a=1; else a=0;
B. if (x%3) a=0; else a=1;
C. if (x%3==0) a=0; else a=1;
D. if (!(x%3==0)) a=1; else a=0;
正确答案:————
23.[单选题] 设有说明 int x=0,y=2; 则执行 if(x=0)y=1+x; else y=x-1; 后,变量y的值是( )
A.-1
B.0
C.1
D.2
正确答案:————
24.[单选题] 有以下程序: main() { int c; while((c=getchar())!= '\n') { switch(c-'2') { case 0 : case 1 : putchar(c+4); case 2 : putchar(c+4); break; case 3 : putchar(c+3); default: putchar(c+2); break; } } printf("\n"); } 当输入:247<回车>,程序的输出结果是( )。
A.689
B.6689
C.66778
D.66887
正确答案:————
25.[单选题] 当顺利执行了文件关闭操作时,fclose函数的返回值是( )。
A.1
B.0
C.-1
D.一个非0值
正确答案:————
26.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_81" o:spid="_x0000_i1098" type="#_x0000_t75" style='width:328.8pt;height:21.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image076.png" o:title=""/></v:shape><!--><!----><img width="438" height="29" v:shapes="图片_x0020_81" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image076.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><span style="color:white"> <o:p></o:p></span></span></p>
A.-3
B.3
C.65539
D.数据不确定
正确答案:————
27.[单选题] 若有定义: int a; 且表达式 !a的值为0,则表达式( )的值为1。
A.a!=0
B.a==0
C.a=0
D.!(a<0 || a>0)
正确答案:————
28.[单选题] 构成C源程序的基本单位是( )
A.语句
B.变量
C.运算符
D.函数
正确答案:————
29.[单选题] 以下程序段的运行结果是( )。 int s=15; switch(s/4) {default: printf("Over "); case 1: printf("One "); break; case 2: printf("Two ");}
A.Two
B.Over Two
C.Over One
D.One
正确答案:————
30.[单选题] 以下程序中的循环执行了( )次。 #define N 2 #define M N+1 #define NUM (M+1)*M/2 main() { int i,n=0; for(i=0;i<NUM;i++) n++;printf("%d\n",n); }
A.5
B.6
C.8
D.9
正确答案:————
31.[单选题] <p class="MsoNormal" style="line-height:20.0pt;mso-line-height-rule:exactly"><span lang="EN-US"><!--><v:shape id="图片_x0020_34" o:spid="_x0000_i1057" type="#_x0000_t75" style='width:307.8pt;height:15.6pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy02-60.files/image034.png" o:title=""/></v:shape><!--><!----><img width="410" height="21" v:shapes="图片_x0020_34" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy02-60.files/image034.png"><!----></span><span lang="EN-US" style="mso-bidi-font-size:10.5pt"><span style="color:white"> <o:p></o:p></span></span></p>
A.1
B.3
C.14
D.28
正确答案:————
32.[单选题] 若有定义 float x;要从键盘输入数据6.02赋给x,则应选用( )语句。
A. scanf("%8.2f",&x);
B. scanf("%1.2f",&x);
C. scanf("%4.2f",&x);
D. scanf("%f",&x);
正确答案:————
33.[单选题] 下面程序的运行结果是( )。 #include <stdio.h> union data { int i; char c; double d; }a; void main() {printf("%d\n",sizeof(a)); }
A.16
B.8
C.4
D.2
正确答案:————
34.[单选题] 语言的 % 运算符按运算对象的个数属( )。
A.单目运算符
B.四目运算符
C.双目运算符
D.三目运算符
正确答案:————
35.[单选题] 下面错误的叙述是( )。
A.预处理命令行必须位于C源程序的起始位置
B.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_157" o:spid="_x0000_i1180" type="#_x0000_t75" style='width:204.6pt;height:15pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image160.png" o:title=""/></v:shape><!--><!----><img width="273" height="20" v:shapes="图片_x0020_157" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image160.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
C.<p class="MsoNormal" style="display:inline;"><span lang="EN-US"><!--><v:shape id="图片_x0020_158" o:spid="_x0000_i1181" type="#_x0000_t75" style='width:294pt;height:15pt; mso-position-horizontal-relative:page;mso-position-vertical-relative:page'> <v:imagedata src="cyy01-60.files/image161.png" o:title=""/></v:shape><!--><!----><img width="392" height="20" v:shapes="图片_x0020_158" src="http://wljy.whut.edu.cn/uploadfiles/word/cyy01-60.files/image161.png"><!----></span><span lang="EN-US" style="font-size:12.0pt"><o:p></o:p></span></p>
D.C语言的预处理可以实现宏定义和条件编译的功能
正确答案:————
36.[单选题] 以下程序段运行后sum的值为( )。 int k=0,sum=0; int a={1,2,3,4,5,6,7,8,9,10,11,12}; for(;k<3;k++)sum+=a;
A.9
B.18
C.19
D.21
正确答案:————
37.[单选题] 若有下面定义,对结构体变量成员不正确引用的语句是( )。 struct pup { char name; int age; int sex; }p,*q; q=p;
A.scanf("%s",p.name);
B.scanf("%d",q->age);
C.scanf("%d",&(q->sex));
D.scanf("%d",&p.age);
正确答案:————
38.[单选题] 已有定义char str1={"computer"},str2;则语句用法正确的是( )。
A.str2=str1;
B.str2="science";
C.scanf("%s",str2);
D.printf("%s",&str1);
正确答案:————
39.[单选题] 设已定义 float a=2.0,b=3.0; 使a值为5.0的表达式是( )。
A.a+= b
B.a*=b+2.0
C.a/=b+2.0
D.a-=b+2.0
正确答案:————
40.[单选题] 以下程序的运行结果是( )。 void main() { int n=9; switch(n--) { default: printf("%d",n++); case 8: case 7: printf("%d ",n); break; case 6: printf("%d ",n++); case 5: printf("%d ",n); } }
A. 8
B. 7
C. 8 9
D. 8 7
正确答案:————
页:
[1]