JAVA笔试_深圳易思博.doc_第1页
JAVA笔试_深圳易思博.doc_第2页
JAVA笔试_深圳易思博.doc_第3页
JAVA笔试_深圳易思博.doc_第4页
JAVA笔试_深圳易思博.doc_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

长沙一度软件教育中心考试说明:本试卷为深圳易思博选人的试题,学员不得带走一、选择题(2分/题)1、根据这个类选择所有正确的内部类:(多选)class A protected int I;A(int i)This.i=I; a.class Bb.class B extends Ac.class BB()System.out.println(“i=”+1);d.class Sclass Ae.class A2、下列所给出的声明中,什么会写入标准输出中?(单选)System.out.println(4|7)?a.4 b.5 c.6 d.7 e.03、下列有关方法notify()(用于和wait()连接)的正确描述是:(单选)a. if there is more than one thead waiting on a condition,only the thread that has been waiting the longest is notified.b. if there is more than one thead waiting on a condition,there is no way to predict which thread will be notified.c. Notify() is defined in the Thread class.d. It is notstrictly necessary to own the lock for the object you invoke notify() for.e. Notify() should only be invoked form within a while loop.4、给出下列类的定义,如没有其他实例的引用,method2()能直接访问到:(多选)class A public int x;private int y;class B protected void method1()class C privated void method2()class d axtends Apublic float z;a. The variable x defined in Ab. The variable y defined in Ac. Method() defined in Bd. The variable z defined in d5、你有一个用ISO 8859-8定义的8位字符串文档,当你要在文本域中写一个显示该文档的应用,而局部编码已经设置成ISO 8859-8时,你如何写一段代码来读取该文档的第一行? (你有3个可获取的变量)a. InputStreamReader reader=new InputStreamReader(stream,8859-8); BufferedReader buffer=new BufferedReader(reader); S=buffer.readLine();b. InputStreamReader reader=new InputStreamReader(stream); BufferedReader buffer=new BufferedReader(reader); S=buffer.readLine();c. InputStreamReader reader=new InputStreamReader(myfile,8859-8); BufferedReader buffer=new BufferedReader(reader); S=buffer.readLine();d. InputStreamReader reader=new InputStreamReader(myfile); BufferedReader buffer=new BufferedReader(reader); S=buffer.readLine();e. FileReader reader=new FileReader(myfile); BufferedReader buffer=new BufferedReader(reader); S=buffer.readLine();6、哪一个对单机程序中的main()方法的声明是错误的?(多选)a. public static void main()b. public static void main(String string)c. public static void main(string args)d. static public int main(String args)e. static void main(String args)7、作为文本框对象的listeners,你可以添加哪一个执行接口?(多选)a. ActionListenerb. FocusListenerc. MouseMotionListenerd. WindowListenere. ContainerListener8、当你试着编译和运行下面的程序时,结果怎样?(单选)class MyTestString s;Public static void main(String args)MyTest m=new MyTest();m.go();void MyTest()s=“constructor”;void go()System.out.println(s);a. This code will not compile.b. This code compiles but throws an exception at runtimec. This code runs but nothing appears in the standard outputd. This code runs and “constructor” in the standard outpute. This code runs and writes “null”in the standard output9.试分析以下两行代码:(多选)float f=3.2;int I=f;a. This code would not compileb. This code would compile and iwould be set to 3.c. The second line would compile if it were written instead as:int I = (byte)ifd. The first line would compile if it were written instead as:float f= 3.2F10.在下面init()方法给出的applet中,用户接口将出现什么情况?(单选)public void init() setlayout(new BorderLayout() add(new Button(“hello”)a. Nothing will appear in the appletb. Abutton will appear in the applet set int the exact center.c. Abutton will appear in the applet along the top and centered horizontally.d. Abutton will appear in the top left corner.11.如果你在JDK1.2X下想要用值将关键字联系起来,则以下哪个类位首选?(多选)a. Dictionaryb. HashTablec. Propertiesd. HashMape. TreeMap12.定义一个名为key的无继承类正确方法是?(单选)a. class Keyb. abstract final class Keyc. native class Keyd. class Keyfinale. finai class Key13.下列哪一个能代表一个octalnumber?(单选)a. 0x12b. 320c. 032d. (octal)2e. 1214.当你运行tester2类时,将得到什么标准输出结果?(单选)class Tester2 int var Tester(double var)This.var =(int)var Tester(int var) This(“hello”) Tester(String S )this ();System.out.println(s);Tester()System.out.println(“good-bye”);public static void main(String args)Tester t = new Tester(5);a. nothingb. “hello”c. 5d. “hello”following by “good -bye”e. “good-bye”following by “hello”15. 根据提供如下代码,如果方法 try This() 发生一个NumberFormatException,将得到什么标准结果?(单选)trytryThis();return;catch(IOException x1)System.out.println(“exception 1”);Return; catch(Exception x2)System.out.println(“exception 2”);Return;finallySystem.out.println(“finally”);a. nothingb. “exception 1”following by “finally”c. “exception 2”following by “finally”d. “exception 1”e. “exception 2”16.给出如下代码,如果此snippet 在标准输出中显示为90,则method()调用了何种数学方法?(单选)double a=90.7;double b=method(a);System.out.println(b);a. absb. minc. floord. rounde. cell17.如果”Ran.test”文档并不存在,而你试图编译并运行一下代码时,将会发生什么情况?(单选)import java.io.*;class Rampublic static void main()(String args) throws IOExcetion RandomAccessFile.out = new RandomAccessFile (“Ran.test”,”rw”);Out.wntebytes(“Ninotchka”); a. The code dose not compile because RandomAccessFile is not created correctly.b. The code dose not compile because RandomAccessFile dose not implement the writeBytes() method.c. The code compiles and runs but throws IOException because “ran.test”does not yet exist.d. The code compiles and runs but nothing appears int the file “ran.test”that it creates.e. The code compiles and runs and “Ninotchka”appears in the file “ran.test” that is creates.18.当你创建一个新的线程时,如果提供一个目标对象,TargetObject是什么类型的实例才能作为合法参数传入;Thread t=new Thread(targetObject);a. targetObject instanceof Thread.b. targetObject instanceof Object.c. targetObject instanceof Applet.d. targetObject instanceof Runnablee. targetObject instanceof String19.给出如下的代码片断,哪一个表达式为合法的java表达式,且返回值为真?(单选);Boolean b1=new Boolean(true);Boolean b2=new Boolean(true);a. b1=b2b. b1.equals(b2)c. b1&b2d. b1 | b2e. b1&b2f. b1 | b220.下列哪一个布局管理器以从左至右,然后从上到下,以每一行为中心移动的方式排列组件?(单选);a. BorderLayoutb. FlowLayoutc. GridLayoutd. CardLayoute. GridBagLayout21.下列哪一个关于垃圾收集的描述是正确的?(多选)a. You can directly free the memory allocated by an objectb. You can directly run the garbage collector whenever you want to.c. The garbage collector informs your object whenever you want tod. The garbage collector reclaims an objects memory as soon as it becomes a candidate for garbage collection.22.Given this interface definition;根据该界面定义,下列哪一个类能实现该接口并不是抽象类?(多选)interface A int method1(lnt I); int method2(int j);ClassBImplementsA Int method1()IntMethod2()a. classBint method1(inti)int method2(intj)c. class BimplementsAint method1(inti)int method2(intj)b. class BextendsA int method1(inti) int method2(intj)c. class BimplementsAint method1(int)int method2(int I)23、Examine the following switch block 根据如下的转换流,下列哪个命题是正确的?(多选)char mychar=c;switch(mychar)default;casea:System.out.println(“a”);break;caseb:System.out.println(“b”);break;a、 This switch block is illegal,because onlyintegers can be used in the switch statement.b、 This switch block is fine.c、 This switch block is illegal,because the default statement must come last.d、 When this code runs,nothing is written to the standard output.e、 When this code runs,the letter”a”is written to the standard output.24、如果你编译,运行以下类,将会出现什么情况?(单选)class Teststatic int myArg=1;pubhc static vold main(Stringargs)int myArg;System.out.printin(myArg);a、 This code compiles and displays 0 in the standard output when run.b、 This code compiles and displays 1 in the standard output when run.c、 This code does not compile because you cannot define a local variable named the same as a static variable.d、 This code does not compile because the local variable is used before it is initialized.25、如果你用名为c的变量为引用组件调用addContainerListener()函数,请估计下列哪个表达式将为这个问题提出正确或错误的回答?(单选)a、 C=Containerb、 c.equals(Class. Container)c、 c instanceof Containerd、 c instanceof Componente、 c implements Container26、当下列程序运行“java Mystery Mighty Mouse”命令时将得到什么结果?(单选)java Mystery Mighty MouseClass MysteryBublic static void main(String args)Changer c=new Changer();c.method(args);System.out.printin(args0+”+args1);static class Changer void method(String s) String temp=s0; s0 = s1;s1 = temp;a. This program causes an ArrayIndexOutOfBoundsException to be thrown.b. This program runs but does not write anything to the standard output.c. This program writes “Myighty Mouse ” to the standard output.d. This program writes “Mouse Myighty “ to the standard output. 27根据提供的如下代码,请问在/A处应该补充什么代码该程序可以标准输出单词running?(单选) Class Run Test implements Runnablepublic static void main(String args) RunTest rt = new RunTest(); Thread t = new Thread(rt); /Apublic void run() System.out.println(“running”);void go() start(1);void start (int i)a. System.out.println(“running”);b. Rs.start():c. Rt.go();d. Rs.start(1);28分析下面的一行代码,选择一个正确的回答(单选)if(5&7 0& 5|2)System.out.println(“true”);a. This line of code will not nomplie.b. This code will compile but nothing will appear in the standard output.c. This code will compile and write the word “true” in the standard output.29.请选出有关在Component 类中定义的paint()方法所有正确的描述:(单选)a. It is protected.b. It takes an instance of class Graphics.c. It is static .d. It is invoed automatically whenever you minimize and then maximize acomponent, such as a window.e. There is also a version that takes an int .30 分析以下代码,选择所有正确的答案。(单选) void looper() int x=0;one; while(x3) Break twc; a. This code compiles.b. This code does not compile.c. This method writes the number 0 to the standard outputd. This method writes the number 1 and 2 to the standard output.e. This method writes the number 3 to the standard output.f. This method writes the number 4 to the standard output.g. This method writes the number 5 through 9 to the standard output.h. This method writes the number 10 to the standard output.31.根据下面的程序判断正确的表达式?(单选)int arr =1,2,3;for (int i=0; i2; i+) arri= 0;a. arr0=0b. arr0=1c. arr1=1d. arr2=0e. arr3=032. 下列关于try, catch 和finally的正确描述是?(多选)a. A try block must always be followed by a catch block.b. A try block can be followed either by a catch block or a finally block, or both.c. A catch block must always be associated with a try block.d. A finally can never stand on its own(that is ,without being associated with try block).e. None of these are true.33. 创建一个新的RandomAccessFile对象的合法模式是?(多选)a. “ w ” b. ” r ” c. ” x ” d. ”rw”34. 当你试图编译和运行这段代码时,将得到什么结果?(单选)abstract class Base abstract public void myfunc(); public void another()System.out.println(“Another method”); public class Abs extends Base public static void main (String argv )Abs a =new Abs();a.amethod(); public void myfunc()System.cut.println(“My Func”); public void amethod()myfunc(); a. The Code will compile and run,printing out the words “My Func”b. The compiler will complain that the Base class has non abstract methods.c. The code will compile but complain at run time that the Base class has not abstract methods.d. The compiler will complain that the method myfunc in the base class has no baby,nobody at all to leave it.35. 以下哪一个是java modifiers(多选)a.public b. private c. friendly d. transient e. vagrant36. 当你试图编译和运行这段代码时,将得到什么结果?(单选)public class Mod public static void main (String argv) public static native void amethod();a. Error at compilation: native method cannot be static.b. Error at compilation native emthod must return value.c. Compilation but error at run time unless you have made code containing native amethod avaible.d. Compilation and execution without error.37. 当你试图编译和运行这段代码时,将得到什么结果?(单选)private class Basepublic class Vis transient int iVal; public static void main (String elephant) a. Compile time error: Base cannot be private.b. Compile time error indicating that an integer cannot be transient .c. Compile time error transient not a data type.d. Compile time error malformed main method.38. 当你试图编译和运行这段代码时,将得到什么结果?(单选)public class Bground extends Thread public static void main(String args)Bround b =new Bground();b.run(); public void start()for (int i =0;i10;i+) System.out.println(“Value of i=”+i)a. A compile time error indicating that no run method is defined for the Thread class.b. A run time error indicating that no run method is defined for the Thread class.c. Clean compile and at run time the values 0 to 9 are printed out.d. Clean compile but no output at runtime.39. 如何使一个线程停止执行?(单选)a. The program exits via a call to System.exit(0).b. Another thread is given a higher priorityc. A call to the threads stop method d. A call to the halt method of the Thread class40. 下列哪一个是JVM执行垃圾收集命令的正确语法?(单选)a. System.free();b. System.setGarbagCollection();c. System.out.gc();d. System.gc();41. 当你试图用命令“hello there”编译和运行这段代码时,将得到什么结果?(单选)public class Arg String MyArg; public static void main (String argv)MyArg=argv; public void amethod()System.out.println(argv1); a. Compile time error.b. Compilation and output of “hello”.c. Compilation and output of “there”.d. None of the above.42. 当你试图编译和运行这段程序时,将得到什么结果?(单选)public class Outer public String name=”Outer”; public static void main (String argv)Inner i =new Inner();i.showName(); /End of main private class InnerString name=new String (“Inner”);Void showName() System.out.println(name); /End of Inner classa. Compile and run with output of “Outer”.b. Compile and run with output of”Inner”c. Compile time error because Inner is declared as private.d. Compile time error because of the line creating the instance of Inner43. 当你试图编译和运行这段代码时,将得到什么结果?(单选)import java.awt.event.*;import java.awt.*;public class

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论