C++期末热身第一部分.docx

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C + + :第一部分 、单项选择题 1、在一个C + +程序中, main函数的位置( 3 )。 必须在程序的开头 必须在程序的后面 ④ ④必须在其它函数中间 4)。 ③函数 ④语句 可以在程序的任何地方 2、C + +程序基本单位是( ①数据 ②字符 1 1)。 3、执行语句 int i=10,*p=i; ①p的值为10 ③*p表示变量i的值 后,下面描述错误的是( ②p指向整型变量i p的值是变量i的地址 后,下面不正确的赋值语句是4、执行语句 int a=5,b=10,c; int * p仁a,* p2=b; 后,下面不正确的赋值语句是 (2 )。 ① *p2=b; ②p仁a; ③ p2=p1; ④ c=*p1*(*p2); 5、设 i=1 , j=2, 则表达式 i++ +j 的值为( 3 )。 ①1 ② 2 ③3 ④ 4 6、设 i=1 , j=2, 则表达式++i+j 的值为( 4)。 ①1 ② 2 ③3 ④ 4 7、执行下列语句后, x的值是( 4 ), y的值是( 3 ) int x,y; x=y=1; ++x||++y; ①不确定 ② 0 ③1 ④2 TOC \o 1-5 \h \z 8、 已知x=5,则执行语句 x+=x-=x X x;后,x的值为( 3 )。 ①25 ②40 ③-40 ④20 9、 已知 a=4, b=6, c=8, d=9,则(a++,ba++cd)?++d:ab ”的值为( 4 )。 ①9 ②6 ③8 ④0 10、有如下程序段: int a=14,b=15,x; char c= A; x=(ab)(c B); 执行该程序段后,x的值为( 1 )。 ① ture ② false ③ 0 11、下面程序的输出结果是( 3 )。 #in clude iostream using n amespace std; int main() { int a=6,b=6; if(a5) a-=1; b+=1; else a+=1; b-=1; cout” a= ” aendl; cout”b” bendl; return 0; } ① 5 7 ② a=5 b=7 12、 下面程序的输出结果是( #in elude iostream using n amespace std; int main() { int a=6,b=6; if(a5) {a-=1; b+=1;} else {a+=1; b-=1;} cout” a= ” aendl; cout” =” bendl; return 0; } ① 5 7 ② a=5 b=7 13、 下面程序的输出结果是( #i nclude iostream using n amespace std; int main() { int x=6,y=8; if(x++6) cout++ye ndl; if(x6) cout --ye ndl; else couty++e ndl; return 0;} ①8 ②7 ③9 14、 下面程序的输出结果是( #i nclude iostream using n amespace std; int main() { int x=6,y=8; if(++x6) ③a=5 b=6 ④编译时出错 2 ) ③ a=5 b=6 ④ a=6 b=5 2 ) ④编译时出错 1 ) cout++ye ndl; else couty++e ndl; if(x6) cout --ye ndl; return 0; } 15、 下面程序的输出结果是( #i nclude iostream using n amespace std; f(int a) { int b=0; static int c=3; b++;c++; return (a+b+c); } int main() { int a=2,i; for(i=0;i3;i++) coutf(a)e ndl; return 0; } ①7 8 9 ②7 7 7 16、 下面程序的输出结果是( #i nclude iostream using n amespace std; void fun (i nt x,i nt y,i nt z) { z=x*x+y*y; } int main() { int z=68; fun (5,2,z); coutz; return 0; } ①0 ②29 ③68 17、 下面程序的输出结果是( #i nclude iostream using n amespace std; int fun (i nt a,i nt b) { return 什+a*b++); } int main() { int x=3,y=4,z=5,r; r=fun (fu n( x,y),

文档评论(0)

136****3783 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档