java笔试题测试1

  • 格式:doc
  • 大小:45.50 KB
  • 文档页数:6

姓名:___________ 出生年月:__________工作年限:____________________ 毕业院校:_______________________ 专业:____________________________ 期望月薪:_______________________政治面貌: ____________________一、选择题(30’)1.下面标示符合法的是()A. 9thMethodB. #myvarC. _SubstituteD. 2variable2. 下面的集合中,()不可以存储重复元素A.Set B.Collection C.Map D.List3.下列语句哪一个正确()A. Java程序经编译后会产生machine codeB. Java程序经编译后会产生byte codeC. Java程序经编译后会产生DLLD.以上都不正确4.关于Map和List,下面说法正确的是( )。

A.Map继承ListB.List中可以保存Map或ListC.Map和List只能保存从数据库中取出的数据D.Map的value可以是List或Map5.能用来修饰interface的有()A.private B.public C.protected D.static6.linux执行以下哪个命令可立刻知道当前所在目录的绝对路径名称()A. pwdB. lsC. mkdirD. cp7.下列哪种说法是正确的()A.在类方法中可用this来调用本类的类方法B.在类方法中调用本类的类方法时可直接调用C.在类方法中只能调用本类中的类方法D.在类方法中绝对不能调用实例方法8. 给定如下Java代码,编译运行的结果是()。

import java.util.*;public class Test {public static void main(String[] args) {LinkedList list=new LinkedList();list.add(“A”);list.add(2,”B”);String s=(String)list.get(1);System.out.println(s);}}A.编译时发生错误 B.运行时引发异常 C.正确运行,输出:A D.正确运行,输出:B9. 接口是一种引用类型,在接口中可以声明( )A. 方法、属性、索引器和事件;B. 方法、属性、事件和私有成员变量;C. 方法、属性、索引器和字段;D. 属性信息、事件和字段;10. 设栈最大长度为 3 ,入栈序列为 1 , 2 , 3 , 4 , 5 , 6 ,则不可能得出栈序列是()A. 1 , 2 , 3 , 4 , 5 , 6B. 2 , 1 , 3 , 4 , 5 , 6C. 3 , 4 , 2 , 1 , 5 , 6D. 4 , 3 , 2 , 1 , 5 , 611. 下列关于修饰符混用的说法,错误的是( )A. abstract不能与final并列修饰同一个类B. abstract类中不可以有private的成员C. static方法中能处理非static的属性D. abstract方法必须在abstract类中12. 当 Frame 改变大小时,放在其中的按钮大小不变,则使用如下哪个 layout? ( )A. FlowLayoutB. CardLayoutC. North and South of BorderLayoutD. East and West of BorderLayoutE. GridLayout13.关于被私有访问控制符private修饰的成员变量,以下说法正确的是( )。

A. 可以被三种类所引用:该类自身、与它在同一个包中的其他类、在其他包中的该类的子类B. 可以被两种类访问和引用:该类本身、该类的所有子类C. 只能被该类自身所访问和修改D. 只能被同一个包中的类访问14. 以下程序代码对Customer的name属性修改了两次:tx = session.beginTransaction();Customer customer=(Customer)session.load(Customer.class, new Long(1));customer.setName(“Jack”);customer.setName(“Mike”);mit();执行以上程序,Hibernate需要向数据库提交几条update语句?()A. 0B.1C. 2D. 315. 哪个类可用于处理 Unicode()A .InputStreamReaderB .BufferedReader C.Writer D.PipedInputStream二、填空题(30’)1.某人去玩具店买小熊,单价30元. 付给玩具店老板100元,玩具店老板没零钱,去水果店换了100元零钱回来找给那人70元. 那人走后, 水果店老板找到玩具店老板说刚才的100元是假币,玩具店老板赔偿了水果店老板100元问:玩具店老板损失了_____________________钱?2. Java编译器可以将Java源程序编译成与机器无关的二进制代码文件,即字节码文件,它的扩展名为______________3.linux中指定某一网络接口的ip地址,可使用命令(_____________________)4. 表达式(3>5)&&(5<7)的值为(________); (2+3)>7||! (6>6)的值为(________)5.有A、B、C、D四个人,要在夜里过一座桥。

他们通过这座桥分别需要耗时1、2、5、10分钟,只有一支手电,并且同时最多只能两个人一起过桥。

请问,如何安排,能够在17分钟内这四个人都过桥?__________________________________________________6. 这个方法的返回值是(___________________________)public int count() {try{return 5/0;} catch(Exception e){return 2*3;} finally {return 3;}}7. 以下程序的打印结果是(_____________________________)tx = session.beginTransaction();Customer c1=(Customer)session.load(Customer.class,new Long(1));Customer c2=(Customer)session.load(Customer.class,new Long(1));System.out.println(c1==c2);mit();session.close();8. 执行如下程序代码a=3;c=0;do{--c;a=a-1;}while(a>0);后,C的值是(____________________________)9.有个表tableXX,有整型的ID项和字符类型的Nickname项,这两个项都不允许为空(1)写出建立该表的SQL语句_____________________________________________(2)找出Nickname为AA的用户,按ID降序排列的SQL语句_________________(3)写出删除ID为124用户记录的SQL语句_______________________________(4)写出添加ID为575,Nickname为'124'的SQL语句_____________________10.下列程序的功能是判断某一年是否为闰年.请在横线处填入适当内容,使程序能够正确运行.import java.io.*;public class LeapYear{public static void main(String arge[])throws IOException{InputStreamReader ir;BufferdeReadwe in;ir=new InputStreamReader(System.in);in=new BufferedReader(ir);System.out.println(“输入年份是:”);String s=______________________________;int year=Integer.parseInt(s);if( ______________________________________________________){System.out.println(""+year+"年是闰年.");}else{System.out.println(""+year+"年不是闰年..");}}}三、算法题(10’)1.创建一个HashMap对象,添加一些学生的姓名和成绩:张三:90分,李四,83分。

接着从HashMap中获取并他们的姓名和成绩,然后把李四的成绩改为100分,再次输出他们的信息。

2.试编写一个List类型的对象只能存储通讯录(存储同学的姓名和联系方式),并输出通讯录的列表到控制台。

四、案例分析(10’)1.设计实现Java连接oracle实例orcl,用户名uesr,密码oracle,并通过交互界面输出查询员工信息表UserInfo中的全部信息。

五、英汉互译(20’)1、英译汉When an alarm occurs, the ICU sends a trap indicating that an alarm has been added to the alarm table; this trap contains the type of alarm. When the alarm has cleared, the ICU sends a trap indicating that the alarm condition has ceased. Alarms are only performed in RAM, not in Flash.Note that certain types of alarms do not set up a persistent condition. These generate a trap and are forgotten. For example, an invalid uplink causes a trap to be generated and then the message deleted.The ICU will maintain two alarm tables: an ICU Alarm Table that contains alarms that pertain to the operation of the entire ICU and a Channel Alarm Table which contains alarms that are channel specific. Although these alarm tables could be combined into one alarm table, for simplicity, two alarm tables are used.2、汉译英计算机在组成上形式不一,早期计算机的体积足有一间房屋的大小,而今天某些嵌入式计算机可能比一副扑克牌还小。