![面向对象程序设计AB_第1页](http://file4.renrendoc.com/view/ba1e93775b5f744d73fff4751f6349c4/ba1e93775b5f744d73fff4751f6349c41.gif)
![面向对象程序设计AB_第2页](http://file4.renrendoc.com/view/ba1e93775b5f744d73fff4751f6349c4/ba1e93775b5f744d73fff4751f6349c42.gif)
![面向对象程序设计AB_第3页](http://file4.renrendoc.com/view/ba1e93775b5f744d73fff4751f6349c4/ba1e93775b5f744d73fff4751f6349c43.gif)
![面向对象程序设计AB_第4页](http://file4.renrendoc.com/view/ba1e93775b5f744d73fff4751f6349c4/ba1e93775b5f744d73fff4751f6349c44.gif)
![面向对象程序设计AB_第5页](http://file4.renrendoc.com/view/ba1e93775b5f744d73fff4751f6349c4/ba1e93775b5f744d73fff4751f6349c45.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
XX大学2008-2009学年第(一)学期考试试卷课程代码 课程名称面向对象程序设计A(JAVA)考试时间120分钟题号一二三四五总成绩得分I 阅卷教师签字: B卷I:注意事项:I1.答题前,请先在试卷和机读卡上对应位置用钢笔准确清楚的填写上本人姓名和学号,i 机读卡的科目栏里填写年级和专业的简称,并用 2B铅笔填涂学号(必须填在前8| 列,剩最右边的一列不填涂);i2.试卷答案必须用2B铅笔在机读卡上按对应题号准确、清楚涂写,答在试卷上无效;I 本试卷共65个小题,1~60小题填写在机读卡上,按【1】~【60】的编号顺序涂写。61~65■题做在答题卷上。【1】~【40】每题1分,【41】~【60】每题2分。【61】~【65】每题4线:分,做在答题卷上,共100分。订一、判断题(本大题共10小题,每小题1分,共10分,正确的填A,错误的填B)封1.数组、类和接口都是引用数据类型。密!2.Java语言中一个char类型的数据占用2个字节大小的内存空间。编译语句〃。沥ZeaDouble=33.5D;时不会出现编译错误。程序中抛出异常时知ow…),只能抛出自己定义的异常对象。:5.所有的文件输入/输出流都继承于InputStream类/OutputStream类。6.一个异常处理中的“缈语句可以有多个。I7.Applet程序不能单独运行,需要嵌入在HTML文件中,借助浏览器来解释执行。8.Java语言在设计员程序时,应注意在服务器端使用0命。1类来处理客户端的连接请求。I9.数组是用来存放一批相同类型的对象或数据,当数据的顺序和个数经常发生变动时就要用到向量来: 存放。10. 构造函数不能被重载。二、单项选择题(本大题共30小题,每小题1分,共30分)I 在每小题列出的四个选项中,只有一个是符合题目要求的,请将其代码填在后面的I答题卷上。错选或未选均无分。订11. 下列哪个属于容器的构件?装 A)JFrameB)JButtonC)JPnel D)JApplet封12. 如果希望所有的控件在界面上均匀排列,应使用下列那种布局管理器?密、 、 、A) BoxLayout B)GridLayoutC)BorderLayoutD)FlowLouLayout!13. Java语言具有许多优点和特点,下列选项中,哪个反映了Java程序并行机制的特点?A)安全性B)多线性 C)跨平台D)可移植I14.14.JavaApplication与Applet所用编译命令相同通常情况下JavaApplication只能有一个main()方法JavaApplet必须有HTML文件才能运行JavaApplet程序的class文件可用java命令运行下列事件监听器中,无法对TextField对象进行事件监听和处理的是ActionListener B)FacusListenerC)MouseMotionListenerD)ChangeListener下列关于Applet的安全限制叙述中,错误的是通常情况下,禁止Applet读写本地文件系统通常情况下,禁止Applet向Applet源主机之外的任何主机建立网络连接通常情况下,禁止pplet读取系统信息通常情况下,禁止Applet加载本地库或方法下列标识符(名字)命名原则中,正确的是类名的首字母小写 B)变量和方法名的首写字母大写C)接口名的首写字母小写 D)常量完全大写作为Java应用程序图形界面基础的是—。Panel B)FrameC)WindowsD)AppletJava不允许多重继承,而利用的设计来达到多重继承的目的。A)类B)接口C)对象D)方法下列哪个选项是合法的标识符?123B)__name C)class D)1first下列关于for循环和while循环的说法中哪个是正确的?while循环能实现的操作,for循环也都能实现while循环判断条件一般是程序结果,for循环判断条件一般是非程序结果两种循环任何时候都可替换〃)两种循环结构中都必须有循环体,循环体不能为空下列关于Java语言特点的叙述中,错误的是A)Java是面向过程的编程语言 B)Java支持分布式计算C)Java是跨平台的编程语言 D)Java支持多线程下列的哪个赋值语句是不正确的?floatf=11.1;B)doubled=5.3E12;C)floatd=3.14f;D)doublef=11.1E10f;下列的哪个赋值语句是正确的?chara=12;B)inta=12.0;C)inta=12.0f; D)inta=(int)12.0;下列哪个修饰符可以使在一个类中定义的成员变量只能被同一包中的类访问?A)private B)无修饰符 C)public D)protected在Applet的关键方法中,下列哪个方法是关闭浏览器以释放Applet占用的所有资源?A)init() B)start() C)paint() D)destroy()给出下列代码,则数组初始化中哪项是不正确的?byte[]array1,array2[];bytearray3[][];byte[][]array4;A)array2=array1B)array2=array3C)array2=array4D)array3=array4下列关于内部类的说法不正确的是内部类的类名只能在定义它的类或程序段中或在表达式内部匿名使用内部类可以使用它所在类的静态成员变量和实例成员变量内部类不可以用沥、"£修饰符定义为抽象类内部类可作为其他类的成员,而且可访问它所在类的成员顺序执行下列程序语句后,则b的值是Stringa="Hello";Stringb=a.substring(0,2);Hello B)hello C)Hel D)null下列常见的系统定义的异常中,哪个是输入、输出异常?A)ClassNotFoundException B)lOExceptionC)FileNotFoundException D)UnknownHostException下列哪个选项是正确计算42度(角度)的余弦值?A)doubled=Math.cos(42); B)doubled=Math.cosine(42);C)doubled=Math.cos(Math.toRadians(42));D)doubled=Math.cos(Math.toDegrees(42));WhichisJavakeyword?A)math B)nullC)FALSE D)TRUEWhichistherangeofinttype?A)-216〜216-1 B)-231-231-1C)-232〜232-1 D)-264〜264-1FilterOutputStreamistheparentclassforBufferedOutputStream,DataOutputStreamandPrintStream.WhichclassesarevalidargumentfortheconstructorofaFilterOutputStream?A)InputStreamB)OutputStreamC)FileD)RandomAccessFileWhichofthefollowingarevaliddeclarations?A)charc='\r'B)charc="cafe"C)charc='0xfg'D)charc="\xef"Whichstatementaboutthegarbagecollectionmechanismaretrue?Garbagecollectionrequireadditionalprogramecodeincaseswheremultiplethreadsarerunning.Thegarbagecollectionsystemneverreclaimsmemoryfromobjectswhilearestillaccessibletorunninguserthreads.TheprogrammerhasamechanismthatexplicityandimmediatelyfreesthememoryusedbyJavaobjects.ThegarbagecollectionmechanismcanfreethememoryusedbyJavaObjectatexplectiontime.Whichofthefollowingistrueofanonymousinnerclass?Anonymousinnerclasscanbedeclaredasprivate,protectedorpublic.Anonymousinnerclasscanimplementmultipleinterfaces.ifnotextendedorimplemented,ananonymousinnerclasscanbecomeimmediatesubclassoftheouterclassorimplementaninterface.ifnotextendedorimplemented,ananonymousinnerclasscanbecomeimmediatesubclassofouterclassorimplementmutipleinterfaces.38.Whichstatementistrueaboutaninnerclass?ItmustbeanonymousItcanimplementaninterfaceItisonlyaccessibleintheenclosingclassItcanaccessanyfinalvariablesinanyenclosingscope.39.Whichisthemain()methodreturnofaapplication?第3页共9页(B卷)A)String B)byteC)char D)voidWhichiscorrectedargumentofmain()methodofapplication?A)Stringargs B)Stringargs[]C)Charargs[][]D)StringBufferarg[]三、单项选择题(本大题共20小题,每小题2分,共40分)在每小题列出的四个选项中,只有一个是符合题目要求的,请将其代码填在后面的答题卷上。错选或未选均无分。阅读下面代码if(x==0)(System.out.println(“冠军”);}elseif(x>-3)(System.out.println(“季军”);}若要求打印字符串“季军”,则变量X的取值范围是A)x!=0&&x>-3B)x=0 C)x>-3||x!=0D)x<=-3假设Foo类有如下定义,设f是Foo类的一个实例,下列语句调用哪个是错误的?publicclassFoo(inti;staticStrings;voidimethod()(}staticvoidsmethod()(}}A)Foo.imethod();B)f.imethod();C)System.out.println(f.i);D)Foo.smethod();给出下列代码,如何使成员变量m被方法fun()直接访问?classTest{privateintm;publicstaticvoidfun(){}}将privateintm改为protectedintm将privateintm改为publicintm将privateintm改为staticintm将privateintm改为intm以下程序运行后的输出结果是:classStaticStuff{staticintx;static{x+=5;}publicstaticvoidmain(String[]args){System.out.println("x="+x);}static{x%=3;}}A)x=0B)x=5C)x=3D)x=2阅读下面程序importjava.*;publicclassTypeTransition{publicstaticvoidmain(Stringargs[]){chara='E';
intm=100;intj=97;intaa=a+m;System.out.println("aa="+aa);charbb=(char)j;System.out.println("bb="+bb);}}如果输出结果的第二行为bb=a,那么第一行的输出是A)aa=100B)aa=169C)aa=97D)aa=69下列哪个选项的java源文件代码片段是不正确的?A)A)packagetestpackage;publicclassTest{}C)importjava.io.*;classPerson{}publicclassTest{}importjava.io.*;packagetestpackage;publicclassTest{}importjava.io.*;importjava.awt.*;publicclassTest{}Giventhefollowingclassdefinition:classA{protectedinti;A(inti){this.i=i;}}whichofthefollowingwouldbeavalidinnerclassforthisclass?A)classB{} B)classBextendsA{}classBextendsA{ D)classB{B(){System.out.println(“i=”i);}classA{}}publicclassHappy{publicstaticvoidmain(Stringargs[]){inti=4;intj=2;methodA(i,j);System.out.println(i);}staticpublicvoidmethodA(inti,intj){i<<=j;}}A)compilationerrorB)16 C)64 D)449.Givethefollowingjavasourcefragment://pointxpublicclassInteresting{//dosomething}WhichstatementiscorrectlyJavasyntaxatpointx?A)importjava.awt.*; B)packagemypackageC)staticintPI=3.14 D)publicclassMyClass(//dootherthing...}Givethefollowingjavaclass:publicclassExample(staticintx[]=newint[15];publicstaticvoidmain(Stringargs[])(System.out.println(x[5]);}}Whichstatementiscorrected?A)Whencompile,someerrorwilloccur. B)Whenrun,someerrorwilloccur.C)Outputiszero. D)Outputisnull.Whatiswrittentothestandardoutputgiventhefollowingstatement:System.out.println(4&7);Selecttherightanswer:A)4B)5C)6D)7Whatiswrittentothestandardoutputgiventhefollowingstatement:System.out.println(7l9);Selecttherightanswer:A)0B)7C)9D)15Looktheinheritancerelation:personman womanInasourceofjavahavethefollowingline:womanw=newman():Whatstatementarecorrected?A)Theexpressionisillegal. B)Compilecorrectedbutrunningwrong.C)Theexpressionislegal. D)Willconstructawomanobject.WhichcanNOTbeusedindeclaringordeclaringandinitializinganautomatic(methodlocal)variable?A)final B)staticC)expressionsD)Constantsofnon-primitivetypeWhichstatementsistrueaboutListeners?AtmostonelistenercanbeaddedtoanysimpleComponent.ThereturnvaluefromalistenerisusedtocontroltheinvocationofotherlistenerIfmultiplelistenersareaddedtoasinglecomponent,theymustallbemadefriendstoeachotherIfmultiplelistenersareaddedtosinglecomponent,theorderofinvocationofthelistenerisnotspecifieD)Floats=newFloat(0.9F);Floatt=newFloat(0.9F);Doubleu=newDouble(0.9);Whichexpression'sresultistrue?A)s!=t B)s.equals(t) C)s==u D)t.equals(u)Givethefollowingmethod:publicvoidmethod()(Stringx,y;x=newString(“helloworld”);y=newString(“gameover”);System.out.println(x+y+"ok'');x=null;x=y;System.out.println(x);}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectxreferedisdefinitelyelibiletobegarbagecollection.beforeline5beforeline6beforeline7Beforeline9Giventhefollowingclassoutline:classExample(privateintx;//restofclassbodypublicstaticvoidmain(Stringargs[])(//implementationofmainmethod}}Whichstatementistrue?A)x=2isavalidassignmentinthemain()methodofclassExample.B)Changingprivateintxtostaticintxwouldmakex=2avalidassignmentinthemain()methodofclassExample.Changingprivateintxtopublicintxwouldmakex=2avalidassignmentinthemain()methodofclassExample.Changingprivateintxtointxwouldmakex=2avalidassignmentinthemain()methodofclassExample.Givefollowingprograme:classEX(publicstaticvoidmain(Stringargs[])(outer:for(inti=0;i<3;i++)inner:for(intj=0;j<3;j++)(if(j>=1)breakouter;System.out.println(j+"and"+i);}}}Whichwillbeoutput?A)0and0B)0and1C)0and2D)0and3Whatwillbetheresultofattemptingtocompileandrunthefollowingcode?abstractclassMineBase(abstractvoidamethod();staticinti;}publicclassMineextendsMineBase(publicstaticvoidmain(Stringargs[])(int[]ar=newint[5];for(i=0;i<ar.length;i++)System.out.println(ar[i]);}}A)asequenceof50’swillbeprinted B)Error:arisusedbeforeitisinitializedC)ErrorMinemustbedeclaredabstract D)IndexOutOfBoundesError四、阅读以下程序,写出运行结果或功能(本大题共5小题,每小题4分,共20分)importjava.io.*;publicclassTest1(publicstaticvoidmain(String[]args)(Loop:for(inti=1;i<15;i++){if(i%3!=0)continueLoop;System.out.printf(i+"");}}}Whatwillbetheoutput?36912importjava.io.*;publicclassTest{publicstaticvoidmain(String
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 肥料农药采购合同样本
- 编程语言与软件开发职业规划作业指导书
- 2025年赣州b2货运资格证多少道题
- 2025年桂林货运从业资格证模拟考试驾考
- 2025年洛阳货车从业资格证考什么
- 2025年博尔塔拉下载货运从业资格证模拟考试题
- 2025年安徽货运车辆从业资格证考试题
- 疾病筛查服务合同(2篇)
- 2024-2025学年高中物理第14章电磁波第3节电磁波的发射和接收课后练习含解析新人教版选修3-4
- voc行业研究报告
- 勾股定理(公开课)2
- 无违法犯罪记录证明申请表(个人)
- 《艺术导论(第二版)》艺术鉴赏
- 身份证籍贯对照表(自动)
- 质量问题分析及措施报告
- 汽修厂安全风险分级管控清单
- 现代通信原理与技术(第五版)PPT全套完整教学课件
- 社区获得性肺炎教学查房
- 病例展示(皮肤科)
- GB/T 39750-2021光伏发电系统直流电弧保护技术要求
- 糖尿病运动指导课件
评论
0/150
提交评论