面向对象编程基础习题及答案.doc

面向对象编程基础习题及答案.doc

ID:58823514

大小:211.00 KB

页数:34页

时间:2020-09-25

面向对象编程基础习题及答案.doc_第1页
面向对象编程基础习题及答案.doc_第2页
面向对象编程基础习题及答案.doc_第3页
面向对象编程基础习题及答案.doc_第4页
面向对象编程基础习题及答案.doc_第5页
资源描述:

《面向对象编程基础习题及答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、面向对象编程基础习题及答案PartI.ChoiceQuestions(1ptforeachquestion).1.Toaddatobandstoreresultinb,youwrite(Note:Javaiscase-sensitive)A.b+=a;B.a=b+a;C.b=A+b;D.a+=b;2.TodeclareaconstantPI,youwriteA.finalstaticPI=3.14159;B.finalfloatPI=3.14159;C.staticdoublePI=3.14159;D.finaldoublePI=3.14159;3.Toimprover

2、eadabilityandmaintainability,youshoulddeclare_________insteadofusingliteralvaluessuchas3.14159.A.variablesB.methodsC.constantsD.classes4.Todeclareanintvariablexwithinitialvalue200,youwriteA.intx=200L;B.intx=200l;C.intx=200;D.intx=200.0;5.Toassignadoublevariabledtoanintvariablex,youwriteA

3、.x=(long)dB.x=(int)d;C.x=d;D.x=(float)d;6.InJava,thewordtrueis________.A.aJavakeywordB.aBooleanliteralC.sameasvalue1D.sameasvalue07.WhichoftheBooleanexpressionsbelowhasincorrectsyntax?A.(true)&&(3>4)B.!(x>0)&&(x>0)C.(x>0)

4、

5、(x<0)D.(x!=0)

6、

7、(x=0)8.Whichofthefollowingisthecorrectexpressionth

8、atevaluatestotrueifthenumberxisbetween1and100orthenumberisnegative?A.11))

9、

10、(x<0)C.((x<100)&&(x>1))&&(x<0)D.(1>x>100)

11、

12、(x<0)1.Whichofthefollowingisthecorrectexpressionofcharactera?A.'a'B."a"C.'00a'D.Noneoftheabove.2.Whichofthefollowingstatementprintssmithexam1

13、test.txt?A.System.out.println("smithexam1test.txt");B.System.out.println("smith\exam1\test.txt");C.System.out.println("smith"exam1"test.txt");D.System.out.println("smith"exam1"test.txt");3.Supposeiisaninttypevariable.WhichofthefollowingstatementsdisplaythecharacterwhoseUnicodeis

14、storedinvariablei?A.System.out.println(i);B.System.out.println((char)i);C.System.out.println((int)i);D.System.out.println(i+"");4.TheUnicodeof'a'is97.WhatistheUnicodefor'c'?A.96B.97C.98D.995.Whichofthefollowingisaconstant,accordingtoJavanamingconventions?A.MAX_VALUEB.TestC.readD.ReadInt6

15、.Whichofthefollowingassignmentstatementsisillegal?A.floatf=-34;B.intt=23;C.shorts=10;D.floatf=34.0;7.AJavastatementendswitha__________.A.comma(,)B.semicolon(;)C.period(.)D.closingbrace8.TheassignmentoperatorinJavais__________.A.:=B.=C.==D.<-1.Supposemandrareintegers.Whati

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。