西北大学2005 ----2006学年第2学期本科考试出题专用纸.doc
上传人:sy****28 上传时间:2024-09-12 格式:DOC 页数:3 大小:96KB 金币:16 举报 版权申诉
预览加载中,请您耐心等待几秒...

西北大学2005 ----2006学年第2学期本科考试出题专用纸.doc

西北大学2005----2006学年第2学期本科考试出题专用纸.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

16 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

姓名年级院系专业学号西北大学2005----2006学年第2学期本科考试出题专用纸考试科目《Java程序设计》总分Objectsofasubclasscanbetreatedlikeobjectsoftheirsuperclass.Noneoftheabove.7.Considertheabstractsuperclassbelow:publicabstractclassFoo{privateinta;publicintb;publicFoo(intaVal,intbVal){a=aVal;b=bVal;}publicabstractintcalculate();}AnyconcretesubclassthatinheritsfromclassFoo:Mustimplementamethodcalledcalculate().Willnotbeabletoaccesstheinstancevariablea.WillnotbeabletoinstantiateanobjectofclassFoo.Alloftheabove.8.WhichofthefollowingisnotavalidconstructorforaJLabel?JLabel(int,horizontalAlignment,Iconimage);JLabel(Iconimage);JLabel(Stringtext,Iconimage,inthorizontalAlignment);JLabel(Stringtext,inthorizontalAlignment);9.WhichofthefollowingstepsisnotrequiredtouseaJLabelasaGUIcomponent?DeclareareferencetoaJLabel.AddtothecontentPane().InstantiatetheJLabel.InitializetheJLabeltext.10.WhichofthefollowingstatementsaboutJTextFieldsandJPasswordFieldsisnottrue?AJTextFieldisaJTextComponent.AJTextFieldisaJPasswordField.JPasswordField(Stringtext,intcolumns)isavalidconstructor.JTextField(Stringtext,intcolumns)isavalidconstructor.11.JTextFieldandJPasswordFieldeventsarehandledusingwhichinterfaces?BothusetheActionListenerinterface.BothusetheTextFieldListenerinterface.BothusetheTextComponentListenerinterface.TheyuseTextFieldListenerandActionListenerinterfacesrespectively.12.ThemethodsetRolloverIconisusedto:Handleamouseevent.Changethebuttontext.Changethebuttonicon.Alloftheabove.注意:答案必须写在统一配发的答题纸上。本试卷满分70分,平时成绩30分。一、SingleChoice(每小题1.5分,共30)1.Whichstatementbelowcouldbeusedtosimulatetheoutputsoftossingaquartertogetheadsortails?1+(int)(Math.random()*6);1+(int)(Math.random()*2);6+(int)(Math.random()*1);1+(int)(Math.random()*25);2.AJButtoncancauseanevent(i.e.,acalltoanevent-handlingmethod)if:Aneventhandlerhasbeencalled.TheregisteredeventhandlerimplementstheActionListenerinterface.TheregisteredeventhandlerextendstheGUI.TheJButtonhasbeenaddedtoJApplet.3.AJavaclasscanhavewhichofthefollowingm