程序员笔试考试题和答案(java)

上传人:平*** 文档编号:13743244 上传时间:2017-10-26 格式:DOC 页数:36 大小:189.08KB
返回 下载 相关 举报
程序员笔试考试题和答案(java)_第1页
第1页 / 共36页
程序员笔试考试题和答案(java)_第2页
第2页 / 共36页
程序员笔试考试题和答案(java)_第3页
第3页 / 共36页
程序员笔试考试题和答案(java)_第4页
第4页 / 共36页
程序员笔试考试题和答案(java)_第5页
第5页 / 共36页
点击查看更多>>
资源描述

《程序员笔试考试题和答案(java)》由会员分享,可在线阅读,更多相关《程序员笔试考试题和答案(java)(36页珍藏版)》请在金锄头文库上搜索。

1、1. Oracle 数据库属于以下哪种数据库类型?BA . 网状数据库B. 关系数据库C. 层次数据库D. 面向对象的关系数据库2. 转发 HTTP 请求一般有两种方法,response.sendRedirect 和 RequestDispatcher.forward,哪种方法可以保存 request.setAttribute()中设置的值不丢 BA. sendRedirectssB forwardC 两个都不能D 两个都可以3. 如果你被要求写一段代码读取一个序列化的对象,那么一般使用哪种 Stream?DA FileInputStreamB FileReaderC DataInputStr

2、eamD ObjectInputStream4. 下列关于 ORALCE 数据库的描述,不正确的是 AA. 索引表含 ROWID 值B. 一个事务即使不被提交 ,也会被写入到重做日志中C. 拥有不同大小的回滚段没有任何益处D. COMMIT 后,数据不一定立即写入数据文件中5. 下面的 main 方法执行到 A 时,str 的值是?Avoid main()String str=”BEA”;this.modify(str);/Avoid modify(String str)str.replace(A,E);str.toLowerCase();str+=”B”;A. ”BEA”B. ”BEE”C.

3、 ”bee”D. ”beeB”6. 下面哪个声明是错误?CA. int i=0xFFFFFFFF;B. byte b=01; C. char c=u0000;D. long l=1234567890L;E. int i=a;7. 下面哪一个 primitive type 和对应的 wrapper class 是错误的?EA. java.lang.IntegerB. g java.lang.LongC. short java.lang.ShortD. void java.lang.VoidE. char java.lang.String8. 下面有关表和视图的叙述中错误的是 BA. 视图的数据可

4、以来自多个表B. 对视图的数据可以来自多个表C. 基表不存在, 不能创建视图D. 删除视图不会影响基表的数据9. MyObject 哪个方法会影响到这段代码的正确性以及效率?CList list=new java.util.ArrayList();List.add(new MyObject(“A”);if(list.indexOf(new MyObject(“A”).A. toStringB. hashCodeC. equelsD. clone10. 指出下列程序运行的结果 Bpublic class ExampleString str=new String(“good”);charch=a,

5、b,c;public static void main(String args)Example ex=new Example();ex.change(ex.str,ex.ch);System.out.print(ex.str+”and”);System.out.print(ex.ch);public void change(String str,char ch)str=”test okj”;ch0=g;A. good and abcB. good and gbcC. test ok and abcD. test ok and gbc11. Which keyword is used to al

6、low interaction with the lock flag ?CA. nativeB. staticC. synchronizedD. abstract12. Which modifier should be used to define a constant member variable?BA. staticB. finalC. abstractD. No modifier can be used13. 给出下面代码:public class Personstatic int arr=new int10;public static void main(String a)Syste

7、m.out.println(arr1);那个语句是正确的?CA. 编译时将产生错误;B. 编译时正确,运行时将产生错误;C. 输出零D. 输出空.14. 欲构造 ArrayList 类的一个实例,此类继承了 List 接口,下列哪个认识方法是正确的?BA. ArrayList myList=new Object();B. List mylist=new ArrayList();C. ArrayList myList=new List();D. List myList=new List();15. What class must an inner class extend;CA. The top

8、 level classB. The Object classC. Any class or interfaceD. it must extend an interfaceSelect the most appropriate answer16. paint()方法使用哪种类型的参数 AA. GraphicsB. Graphics2D C. StringD. Color17. 下列哪个语句关于内存回收的说明是正确的 BA. 程序员必须创建一个线程来释放内存 ;B. 内存回收程序负责释放无用内存C. 内存回收程序允许程序员直接释放内存D. 内存回收程序可以在指定的时间释放内存对象18. 下列代码

9、哪些行会出错 BC1)public void modify()2)int I,j,k;3)I=100;4)while(I0)5)j=I*2;6)System.out.println(The value of j is + j);7)k=k+1;8)I-;9)10) A. line 4B. line 6C. line 7D. line 819. Given the following fragment of code;Double d1=newDouble(1.0);Double d2=newDouble(1.0);Float f=new Float(1.0F);Which results of

10、 the following expressions are true?BA. d1=d2B. d1.equals(d2)C. d1=fD. f.equals(d1)20. 对于下列代码:1)class Person2)public void printValue(int i,int j)/.3)public void printValue(int i)/4)5)public class Teacher extends Person6)public void printValue()/7)public void printValue(int i)/8)public static void ma

11、in(String args)9)Person t=new Teacher();10)t.printValue(10);11)12)第 10 行语句将调用哪行语句?DA. line 2B. line 3C. line 6D. line 721. where in a constructor,can you place a call to a constructor defined in the super class.?BA.AnywhereB.The first statement in the constructorC.The last statement in the construct

12、orD.You cant call super in a constructorselect the most appropriate answer.22. Given the following method in an application: A1.public String setFiletype(String fname)2.int p=fname.indexOf(“.”);3.if(p0)fname=fname.substring(0,p);4.fname+=”.TXT”;5.return fname;6.And given that another part of the cla

13、ss has a the following code:7.String TheFile=”Program.java”;8.File F=new File(setFileType(TheFile);9.System.out.println(“Created”+TheFile);What will be printed by the statement in line 9.A. Created Program.javaB. Created Program.txtC. Created Program.java.txt23. main()方法的返回类型是:BA.intB.voidC.booleanD

14、.static24. 类 Teacher 和 Student 是类 Person 的子类:Person p;Teacher t;Student s;file:/p,t and s are all non-null.if( t instanceof Person)s=(Student)t;最后一句语句的结果是:CA.将构造一个 Student 对象;B.表达式是合法的;C.表达式是错误的;25. 下面的异常处理正确的是(D )Atry 块必须同时与 catch 子句和 finally 子句一起使用。Btry 块只能使用一个 catch 子句。Ctry 块中如果执行了 return 语句,则其 f

15、inally 子句不会执行。Dtry 块不能单独使用。26. 下列对继承的说法,哪个是正确的(D )A子类能继承父类的私有方法和状态。B子类能继承父类的 protected 方法,而不继承 protected 状态C子类只能继承父类 public 方法和状态D子类能继承父类的所有非私有方法和状态27. 随着 JAVA 技术的不断发展,Sun 公司根据市场进一步将 java 细分,其中对普通 PC应用的是(B)AJ2EEBJ2SECJ2MEDJDK28. 下列选项中哪一个编译不出现错误?(C)Aint i=0;if(1)System.out.println(“Hi”);Bint i1=5;int i2=5;if(i1=i2)System.out.println(“So true”);C. int i=1;int j=2;if(i=1|j=2)System.out.println(“OK”);D. int i=1;int j=2;if(i=1&|j=2)System.out.println(“OK”);29. 下列关于 java 程序结构说法错误的是(D ) 。Apackage 语句必须放在源文件的第一句B源文件可以没有 import 语句C一个源文件可以有多个类定义D一个源文件可以定义多个 public 类30

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 试题/考题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号