笔试网 我爱你公交网 学校地址网 邮编查询 院校信息网 面试网 笔试网

java软件开发求职试题集合


点击下载:java软件开发求职试题集合PDF版 java软件开发求职试题集合Word版

简答题:

(1)try-catch-finally语句的执行顺序是怎样的?

(2)mvc的各个部分都有那些技术来实现?如何实现?

(3)jdo是什么?

(4)设计一个类,使得该类任何形式的派生类无论怎么定义和实现,都无法产生任何对象 实例。

(5)给定一个c语言函数,要求实现在java类中进行调用。

(6)设下列函数已经通过了调试
bool sort_array(arraytype * pinputarray, arraytype * poutarray);该函数在内存中排序,能把字节数最大为100m字节的arraytype类型的数组排序。其中arraytype是一个预定义的数组类型(细节无关紧要),pinputarray,poutarray分别为排序前的指针和排序后的指针。
请用c语言的伪码风格设计一个算法,他调用上面给出的函数完成下列从输入到输出的任务:
输入:排序前的大文件,名称为char * pinoutfilename ,其内容为用分号分隔的arraytype类型的数组元素,可装满4个100m字节的数组。
输出:排序后的大文件char * poutoutfilename。

(7)马克思在《数学手稿》中提出如下问题:有30个人(包括男人、女人和小孩)在一家饭店吃饭共花50先令,其中每个男人花3先令,每个女人花2先令,每个小孩花1先令,问男人、女人、小孩各有多少人?

(8)说说lucene中使用的设计模式,并举例。

(9)给出了从纽约出发和到达洛杉机的各种航班信息,写出找到一条从纽约到洛杉机的最短距离的航班组合的代码。

(10)在java中,throw与throws有什么区别?他们各自用在什么地方?

(11)在使用spring开发的j2ee分层结构中,service层一般都有xxxmanager接口,请问他的作用是?

(12)设计算法以求解从集合{1..n}中选取k(k<=n)个元素的所有组合。例如,从集合{1..4}中选取2个元素的所有组合的输出结果为:1 2,1 3,1 4,2 3, 2 4,3 4。

(13)请用java写二叉树算法,实现添加数据形成二叉树功能,并以先序的方式打印出来。

(14)应用服务器与web server的区别?

(15)tomcat中用来编译jsp页面的是哪个类,或者哪个模块?

(16)说出arraylist,vector, linkedlist的存储性能和特性。


(17)有一篇英文文章(也就是说每个单词之间由空格分隔),请找出“csdn”着个单词出现的次数,要求效率最高,并写出算法的时间级。

(18)tomcat的集群是如何工作的?举例说明。

(19)servlet的基本架构?写出主要方法。


(20)请问你在什么情况下会在你的java代码中使用可序列化?为什么放到httpsession中的对象必须要是可序列化的?

(21)写一个方法,删除java源文件中的注释,

(22)求符合指定规则的数。
给定函数d(n) = n n的各位之和,n为正整数,如 d(78) = 78 7 8=93。 这样这个函数
可以看成一个生成器,如93可以看成由78生成。
定义数a:数a找不到一个数b可以由d(b)=a,即a不能由其他数生成。现在要写程序,找出
1至10000里的所有符合数a定义的数。
输出:
1
3


(23)简单介绍jsp的标记库?

(24)100位以上的超大整数的加法(主要考虑数据结构和加法的实现)。

(25)说出servlet的生命周期,并说出servlet和cgi的区别。

(26)写出不带头结点的双向链表的插入排序算法。

(27)找出字符串a中包含的字符可以进行的所有不同组合。例如:abccd中,ab,ac,bc,cc,abd等都是可能的组合。

(28)pring中常见的通知有哪些?

(29)java多线程编程。 用java写一个多线程程序,如写四个线程,二个加1,二个对一个变量减一,输出。

(30)输入三个字符串,把它们按字典排列依从小到大的顺序输出。例如输入:aec,adc,abc 三个字符串,它们按字典排列依从小到大的顺序输出为:abc,adc,aec。

(31)什么是异常?举出程序中常见的异常的种类?

(32)简述:某广告投放系统采用b/s结构,其主要用户为广告主,广告主可通过该广告投放系统在各个网站上投放广告并查看投放效果。该广告系统需要实现如下功能:
1) 用户可向自己账户中加款。
2) 用户可提交广告,广告包括四种形式:文字广告,图片广告,flash广告和对媒体广告。
3) 用户可制定哪些广告在哪些网站上展现,用户可分别广告在制定网站上的点击单价
4) 广告被点击时,直接从用户账户中扣除相应的钱款
5) 用户账户余额不足时,所有广告失效,用户加款后,恢复生效。
6) 用户可查询广告的每日消费情况(点击次数、消费额)、广告在各个网站的消费情况。
要求:1)设计该系统的数据表结构,要求满足上述功能,结构清晰,并尽可能灵活。
2)写出功能6所涉及的sql语句
3)请分析随着广告主的增加、广告点击次数的增长,系统可能会在哪些方面出项性能瓶颈?你在设计时是如何考虑解决这些瓶颈的?潜在的性能瓶颈还有哪些?

(33)在web开发中需要处理html标记时,应做什么样的处理,要筛选那些字符( & "")?

(34)there are two int variables: a and b, don’t use “if”, “? :”, “switch”or other judgement statements, find out the biggest one of the two numbers.

(35)写一个程序做低于256位整数的运算,并有如下输出:
比如输入: 12,23 输出:
12
*23
------
36
24
------
276

(36)tomcat中用来编译jsp页面的是哪个类,或者哪个模块?

(37)spring中bean作用域的singleton和设计模式中singleton的作用域是一回事吗?

(38)马克思在《数学手稿》中提出如下问题:有30个人(包括男人、女人和小孩)在一家饭店吃饭共花50先令,其中每个男人花3先令,每个女人花2先令,每个小孩花1先令,问男人、女人、小孩各有多少人?

(39)打印一个n*n的方阵,n为每边字符的个数( 3〈n〈20 ),要求最外层为“x”,第二层为“y”,从第三层起每层依次打印数字0,1,2,3,...
例子:当n =5,打印出下面的图形:
x x x x x
x y y y x
x y 0 y x
x y y y x
x x x x x

(40)对象流只能读/写对象吗?还能读/写其它数据吗?为什么?

(41)整数转换为字符串。

(42)两个单向链表,有可能交叉,请设计算法判断是否交叉,如果交叉,返回交叉点!算法复杂度o(n)

(43)四个小孩正在花园里玩追捕游戏。一个小孩扮演逃亡者,其余三个小孩做追捕者。花园是一块由n行m列方格组成的草地,花园周围有木栏包围着,不能走出,花园里面还有一些障碍物不能够通过。游戏可以进行许多回合,每个回合分成两轮,第一轮追捕者可以进行追捕行动,第二轮逃亡者可以根据前一轮追捕者的行动开展逃亡旅程。在第一轮里,三个追捕者必须在三人中选择一个人向某个相邻的方格走一步,只有在三个人都没有可以走的相邻方格时,他们才允许选择停留在原地。在第二轮里,逃亡者也必须选择某个相邻的方格走一步,如果逃亡者没有任何可走的方格,那么逃亡者就被捕了。四个小孩都不允许走到有障碍物或其他人的方格上,也不能走出花园,因而,四个小孩总是会位于不同的方格上面。

  这些小孩都是非常聪明的,三个追捕者也是团结一致的。追捕者如果有可以捉到逃亡者的方法,那么他们就一定不会错过。逃亡者如果有不被捕获的方法,那么他也不会犯错。除此之外,追捕者会希望尽快地捉到逃亡者,而逃亡者即使在会被捕获的情况下也会尽可能地拖延时间。给定花园的障碍物的分布图和四个小孩的初始位置,你知道追捕者有方法捉到逃亡者吗?如果有,他们要经过多少轮后才能捉到逃亡者呢?

(44)overload和override的区别。overloaded的方法是否可以改变返回值的类型?


(45)security 公司的网络管理工程师mr. leak最近发现有不少来自公司外部ip的请求,试图非法访问公司内部资源,为了不影响数据访问流程。他不得不写一个高效的程序——一个工作在ipv4上的防火墙,如果请求来自非授权的ip地址,则将请求丢弃。为了便于管理,通过文本文件ip.txt来配置授权的ip地址,文件格式为每行(’/n’)一个 ip地址(或ip段),范围不超过一个b类。例如:
162.105.91.163
59.66.105.0 59.66.105.255
211.71.0.0 211.71.255.255
限制:ip段的起止地址间以空格隔开。文件不超过10万行,内存不超过4m字节。
要求:请编写一个程序,读入ip.txt文件。并从标准输入接受一个ip地址。如果该地址在授权范围内,则在标准输出上打印y,否则打印n.如果输入为一个空行,程序结束。
请给出思路(文字描述),完成代码,分析你采用算法的优劣。请列举测试方法和思路

(46)用递归法将一个整数n转换成字符串(例如输入4679,应输出字符串“4679”),n为不确定数,可以是位数不超过5,且数值在-32768~32767之间和任意整数。

(47)在jsp中如何读取客户端的请求,如何访问cgi变量,如何确定某个jsp文件的真实路径。

(48)++i与i++的区别到底怎样?

(49)到底在哪里使用cascade="..."?

(50)试为下列关键字设计哈希表,要求所设计的表在查找成功时的平均查找长度不超过2.0。并请验证你造的哈希表的实际平均查找长度时否满足要求。(cha,cai,lan,wen,long,zhao,wu,liu,chen,li,wang,cao,yun,chang,yang)

(51)在java中一个类被声明为final类型,表示了什么意思?

(52)在weblogic管理制台中对一个应用域(或者说是一个网站,domain)进行jms及ejb或连接池等相关信息进行配置后,实际保存在什么文件中?

(53)如何启动时不需输入用户名与密码?

(54)在java中,throw与throws有什么区别?他们各自用在什么地方?

(55)tomcat支持cgi吗?

(56)简述:某广告投放系统采用b/s结构,其主要用户为广告主,广告主可通过该广告投放系统在各个网站上投放广告并查看投放效果。该广告系统需要实现如下功能:
1) 用户可向自己账户中加款。
2) 用户可提交广告,广告包括四种形式:文字广告,图片广告,flash广告和对媒体广告。
3) 用户可制定哪些广告在哪些网站上展现,用户可分别广告在制定网站上的点击单价
4) 广告被点击时,直接从用户账户中扣除相应的钱款
5) 用户账户余额不足时,所有广告失效,用户加款后,恢复生效。
6) 用户可查询广告的每日消费情况(点击次数、消费额)、广告在各个网站的消费情况。
要求:1)设计该系统的数据表结构,要求满足上述功能,结构清晰,并尽可能灵活。
2)写出功能6所涉及的sql语句
3)请分析随着广告主的增加、广告点击次数的增长,系统可能会在哪些方面出项性能瓶颈?你在设计时是如何考虑解决这些瓶颈的?潜在的性能瓶颈还有哪些?

(57)不允许使用系统时间,写出一个随机数生成函数。

(58)设有一个顺序表a,包含n个元素,要求写出一个将该表逆置的算法,并只允许在原表的存储空间少再加一个附加的工作单元。

(59)介绍j2ee、j2se、j2me的区别。

(60)如何判定两条线段是否相交?

(61)请说出你所知道的线程同步的方法。

(62)写一个方法(函数):判断一个单链表中是是否有环?

(63)anonymous inner class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?


(64)四个小孩正在花园里玩追捕游戏。一个小孩扮演逃亡者,其余三个小孩做追捕者。花园是一块由n行m列方格组成的草地,花园周围有木栏包围着,不能走出,花园里面还有一些障碍物不能够通过。游戏可以进行许多回合,每个回合分成两轮,第一轮追捕者可以进行追捕行动,第二轮逃亡者可以根据前一轮追捕者的行动开展逃亡旅程。在第一轮里,三个追捕者必须在三人中选择一个人向某个相邻的方格走一步,只有在三个人都没有可以走的相邻方格时,他们才允许选择停留在原地。在第二轮里,逃亡者也必须选择某个相邻的方格走一步,如果逃亡者没有任何可走的方格,那么逃亡者就被捕了。四个小孩都不允许走到有障碍物或其他人的方格上,也不能走出花园,因而,四个小孩总是会位于不同的方格上面。

  这些小孩都是非常聪明的,三个追捕者也是团结一致的。追捕者如果有可以捉到逃亡者的方法,那么他们就一定不会错过。逃亡者如果有不被捕获的方法,那么他也不会犯错。除此之外,追捕者会希望尽快地捉到逃亡者,而逃亡者即使在会被捕获的情况下也会尽可能地拖延时间。给定花园的障碍物的分布图和四个小孩的初始位置,你知道追捕者有方法捉到逃亡者吗?如果有,他们要经过多少轮后才能捉到逃亡者呢?

(65)
指出下面代码的错误,说明原因。
interface  a{
   int x = 0;
}
class b{
   int x =1;
}
class c extends b implements a {
   public void px(){
      system.out.println(x);
   }
   public static void main(string[] args) {
      new c().px();
   }
}


(66)请阐述一下你对“面向接口编程”的理解。

(67)hibernate在什么情况下需要重载hashcode和equals方法?

(68)100位以上的超大整数的加法(主要考虑数据结构和加法的实现)。

(69)一列数的规则如下: 1、1、2、3、5、8、13、21、34. 求第30位数是多少, 用递归算法实现。


(70)比较两个字符串,用o(n)时间和恒量空间。

(71)求出 10 到 100 之间的素数(只能被 1 和自身整除的数)并以每行一个素数的格式顺序写入文件 su.dat 。

(72)solve this cryptic equation, realizing of course that values for m and e could be interchanged. no leading zeros are allowed.
  wwwdot - google = dotcom

(73)写一段程序,找出数组中第k大小的数,输出数所在的位置。例如{2,4,3,4,7}中,第一大的数是7,位置在4。第二大、第三大的数都是4,位置在1、3随便输出哪一个均可。

(74)请阐述一下你对ioc(inversion of control)的理解。

(75)巧排数字,将1,2,...,19,20这20个数字排成一排,使得相邻的两个数字之和为一个素数,且首尾两数字之和也为一个素数。编程打印出所有的排法。

(76)垃圾回收机制,如何优化程序?

(77)使用tomcat部署应用程序 遇到过java.lang.outofmemoryerror 吗?如何解决的。

(78)有篇文章,找出文章中单词在词典中的序号,要求高效率.词典没排序。

(79)ejb包括(sessionbean,entitybean)说出他们的生命周期,及如何管理事务的?

(80)巧排数字,将1,2,...,19,20这20个数字排成一排,使得相邻的两个数字之和为一个素数,且首尾两数字之和也为一个素数。编程打印出所有的排法。

(81)编写一个确定一字符串在另一字符串中出现次数的算法。例如字符串“this”在字符串“this is my first program. this…”中出现了2次,不要使用库函数(方法)。

(82)编写子函数:(1)用冒泡法将一个数组排成升序的函数---sub1;(2)在升序数组中插入一个数,并且保持该数组仍为升序数组的函数---sub2。主函数:①输入任意10个正整数给数组;②调用sub1对数组进行排序;③从键盘输入一个正整数,调用sub2将其插入该数组。

(83)序列中的“中值记录”指的是:如果将此序列排序之后,它是第n/2个记录。试写出一个求中值记录的算法。

(84)有一个整数n,写一个函数f(n),返回0到n之间出现的\"1\"的个数。比如f(13)=6,现在f(1)=1,问下一个最大的f(n)=n的n是什么?

(85)集群的优点和缺点?

(86)整数转换为字符串。

(87)

1:
请阐述一下你对java多线程中“锁”的概念的理解。

(88)hibernate中到底在哪里使用inverse="true"

(89)写一个程序做低于256位整数的运算,并有如下输出:
比如输入: 12,23 输出:
12
*23
------
36
24
------
276

(90)怎样在复杂的各种形式的网页中提取mp3下载的结构化数据?

(91)类的静态成员和非静态成员有何区别?

(92)调用系统命令实现删除文件的操作。

(93)多线程有几种实现方法,都是什么?同步有几种实现方法,都是什么?

(94)用最有效率的方法算出2乘以8等於几?

(95)什么是异常?试列出三个系统定义的运行时异常类。

(96)在java中,throw与throws有什么区别?他们各自用在什么地方?

(97)设计一个简单的网页抓取系统,目标是抓取z.baidu.com站点上的有价值网页。
1) 请设计基本模型,并做出简要说明。请考虑如何获取网页、如何存储网页、如何判断网页的价值。。。。。。。。
2) 实际应用中,需要考虑哪些因素。

(98)string与stringbuffer的区别。

(99)tomcat里实现会话session复制,有那些方法?

(100)简述 jdbc 的基本功能。

(101)同步和异步有和异同,在什么情况下分别使用他们?举例说明。

(102)如果只想让程序有一个实例运行,不能运行两个。像winamp一样,只能开一个窗口,怎样实现?

(103)spring的容器的实际代表者是哪个类(接口),该类常见的子类有那些?

(104)class.forname的作用?为什么要用?

(105)请用java写二叉树算法,实现添加数据形成二叉树功能,并以先序的方式打印出来。

(106)
写出输出结果:
public class test
{
   public static int a = 5;

   public static void main(string[] args)
  {
     test test = new test();

     test = null;

     system.out.println(test.a);
  }

} 


(107)
class something {
    final int i;
    public void dosomething() {
        system.out.println("i = " + i);
    }
}
上面代码正确还是错误?为什么。


(108)什么是异常?试列出三个系统定义的运行时异常类。

(109)在使用spring开发的j2ee分层结构中,service层一般都有xxxmanager接口,请问他的作用是?

(110)请设计一个java程序,程序中要进行数组操作和除法操作,要求对所设计的程序可能出现的异常进行处理。

(111)试举例说明一个典型的垃圾回收算法?

(112)插入一个节点到一个有序链表。

(113)security 公司的网络管理工程师mr. leak最近发现有不少来自公司外部ip的请求,试图非法访问公司内部资源,为了不影响数据访问流程。他不得不写一个高效的程序——一个工作在ipv4上的防火墙,如果请求来自非授权的ip地址,则将请求丢弃。为了便于管理,通过文本文件ip.txt来配置授权的ip地址,文件格式为每行(’/n’)一个 ip地址(或ip段),范围不超过一个b类。例如:
162.105.91.163
59.66.105.0 59.66.105.255
211.71.0.0 211.71.255.255
限制:ip段的起止地址间以空格隔开。文件不超过10万行,内存不超过4m字节。
要求:请编写一个程序,读入ip.txt文件。并从标准输入接受一个ip地址。如果该地址在授权范围内,则在标准输出上打印y,否则打印n.如果输入为一个空行,程序结束。
请给出思路(文字描述),完成代码,分析你采用算法的优劣。请列举测试方法和思路

(114)下面的代码在绝大部分时间内都运行得很正常,请问在什么情况下会出现问题?问题的根源在哪里?
import java.util.linkedlist;

public class stack {

linkedlist list = new linkedlist();

public synchronized void push(object x) {
synchronized(list) {
list.addlast( x );
notify();
}
}

public synchronized object pop()
throws exception {
synchronized(list) {
if( list.size() <= 0 ) {
wait();
}
return list.removelast();
}
}
}

(115)已知数组 a 中的元素是从小到大排序的,要求对于任意输入的一个整数 x ,把它插到数组 a 后,仍保持数组 a 的排序次序不变。

(116)找到一个子字符串,优化速度,优化空间。

(117)用最简单的方法判断一个数是否是2的指数次幂。

(118)randomaccessfile类的主要用途是什么?它和file类有什么区别?

(119)四个小孩正在花园里玩追捕游戏。一个小孩扮演逃亡者,其余三个小孩做追捕者。花园是一块由n行m列方格组成的草地,花园周围有木栏包围着,不能走出,花园里面还有一些障碍物不能够通过。游戏可以进行许多回合,每个回合分成两轮,第一轮追捕者可以进行追捕行动,第二轮逃亡者可以根据前一轮追捕者的行动开展逃亡旅程。在第一轮里,三个追捕者必须在三人中选择一个人向某个相邻的方格走一步,只有在三个人都没有可以走的相邻方格时,他们才允许选择停留在原地。在第二轮里,逃亡者也必须选择某个相邻的方格走一步,如果逃亡者没有任何可走的方格,那么逃亡者就被捕了。四个小孩都不允许走到有障碍物或其他人的方格上,也不能走出花园,因而,四个小孩总是会位于不同的方格上面。

  这些小孩都是非常聪明的,三个追捕者也是团结一致的。追捕者如果有可以捉到逃亡者的方法,那么他们就一定不会错过。逃亡者如果有不被捕获的方法,那么他也不会犯错。除此之外,追捕者会希望尽快地捉到逃亡者,而逃亡者即使在会被捕获的情况下也会尽可能地拖延时间。给定花园的障碍物的分布图和四个小孩的初始位置,你知道追捕者有方法捉到逃亡者吗?如果有,他们要经过多少轮后才能捉到逃亡者呢?

(120)应用服务器有那些?

(121)session是存储在什么地方,以什么形式存储的。

(122)写一个生成随机数的类(或者函数)。

(123)简述lucene的体系结构?

(124)
介绍java中的collection framework(包括如何写自己的数据结构)?


(125)说一说servlet的生命周期?

(126)请写一个java程序实现线程连接池功能?

(127)jsp有哪些内置对象?作用分别是什么?

(128)简述数据库中事务的概念及其性质。

(129)假设一个数据库中有 3 个关系:
  客户关系 c ( c# , cn , ca ),属性的含义依次为客户号、客户名称和地址;
  产品关系 p ( p# , pn , pr , ps ),属性的含义依次为产品号、品名、单价和供应商;
  订单关系 r ( r# , c# , p# , rd , qty ),属性的含义依次为订单号、客户号、产品号、日期和数量。规定一张订单只能订购一种产品。
  用 sql 语句写出下列查询:
  列出客户订购产品信息,包括日期、客户号、客户名称、品名和数量。

(130)非聚簇索引在什么情况下效果最好?

(131)设有职工关系emp(职工号,姓名,性别,工资,部门号)。职工吴刚从销售部调到人事部、请用sql语句写出该操作。

(132)编写一个算法实现两个有序(从小到大)顺序表合并为一个顺序表,合并后的结果放在第一个顺序表中,不另设新的顺序表存储(假设这两个有序顺序表中没有相同的元素)。

(133)管理50台数据库,日常工作是检查数据库作业是否完成,你该如何完成这项检查工作?

(134)分析isam文件(indexed sequrntial access methord)和vsam(virtual storage methord)的应用场合、优缺点等。

(135)自己定义数据结构,写出程序:二叉树的前序遍历。

(136)一个".java"源文件中是否可以包括多个类(不是内部类)?有什么限制?

(137)什么是异常?举出程序中常见的异常的种类?

(138)写一个程序做低于256位整数的运算,并有如下输出:
比如输入: 12,23 输出:
12
*23
------
36
24
------
276

(139)简单介绍jsp的标记库?

(140)不允许使用系统时间,写出一个随机数生成函数。

(141)
class something {
    int i;
    public void dosomething() {
        system.out.println("i = " + i);
    }
}
代码是否有错?为什么。


(142)
找出以下程序错误。
class test{
    private string par1;
    private string par2;
    test(){
    }
    
    public static void main(string[] arg){
        int a ;
        if(a){
            system.out.println("par1="+par1);
        }else{
            system.out.println("par2=" + par2);
        }
    }
}


(143)给定一个c语言函数,要求实现在java类中进行调用。

(144)编写一个c语言函数(java方法),要求输入一个url,输出该url是首页、目录页或者其他url
如下形式叫做首页:
militia.info/
www.apcnc.com.cn/
http://www.cyjzs.comwww.greena888.com/
www.800cool.net/
http://hgh-products.my-age.net/
如下形式叫做目录页:
thursdaythree.net/greenhouses--gas-global-green-house-warming/
http://www.mw.net.tw/user/tgk5ar1r/profile/
http://www.szeasy.com/food/yszt/chunjie/
www.fuckingjapanese.com/reality/
请注意:
a) url有可能带http头也有可能不带
b)动态url(即含有"?"的url)的一律不算目录页,如:
www.buddhismcity.net/utility/mailit.php?l=/activity/details/3135/
www.buddhismcity.net/utility/mailit.php?l=/activity/details/2449/

(145)how to open a host and send a stream throught net in tcp/ ip using java

(146)一个类只有实现了serializable接口或者externalizable接口,它的对象才可以被序列化。请问,这两种序列化机制有何区别?

(147)写一个程序,把一个100以内的自然数分解因数。(自然数分解因数就是将一个自然数分解为几个素数的乘积,提示,由于该数不是很大,所以可以将质数保存在数组中,以加快计算速度)

(148)string与stringbuffer的区别。

(149)求出 10 到 100 之间的素数(只能被 1 和自身整除的数)并以每行一个素数的格式顺序写入文件 su.dat 。

(150)字符串a是由n个小写英文字母(a ~ z)构成的,定义为char a[n]。你能用更少的空间表示这个字符串吗?请写出从char a[n]到你的新的储存格式的转换函数。

(151)描述jsp和servlet的区别、共同点、各自应用的范围?

(152)hibernate,现在有一个blog表,有id,title ,content,date,author等字段,现在需要返回一个标题列表,即返回的blog对象中id,title,date,author,如何做?

(153)介绍j2ee、j2se、j2me的区别。

(154)abstract class和interface有什么区别?

(155)简述lucene的体系结构?

(156)写一个方法(函数):判断一个单链表中是是否有环?

(157)session是存储在什么地方,以什么形式存储的。

(158)你使用hibernate过程中,遇到那些异常?

来源:笔试网 http://www.ipmao.com/ 面试网 http://www.mianshiwang.com/

选择题:

(1)
what will happen when you attempt to compile and run the following code?

(assume that the code is compiled and run with assertions enabled.)

public class asserttest{

public void methoda(int i){

assert i >= 0 : methodb();

system.out.println(i);

}

public void methodb(){  

system.out.println("the value must not be negative");

}

public static void main(string args[]){

asserttest test = new asserttest();

test.methoda(-10); 

}

}

a.it will print -10
b.it will result in assertionerror showing the message-“the value must not be negative”.
c.the code will not compile.
d.none of these.


(2)
what will happen when you attempt to compile and run the following code? 

class base 

{

int i = 99; 

public void amethod()

{

       system.out.println("base.amethod()");

     }

     base()

{

     amethod();

     }

} 

public class derived extends base

{

int i = -1;

       

public static void main(string argv[])

{

     base b = new derived();

       system.out.println(b.i);

       b.amethod();

     } 

     public void amethod()

{

       system.out.println("derived.amethod()");

     } 

} 

choices:

a.derived.amethod() -1 derived.amethod()
b.derived.amethod() 99
c.compile time error
d.derived.amethod()


(3)which statement about listener is true?
a.most component allow multiple listeners to be added.
b.if multiple listener be add to a single component, the event only affected one listener.
c.component don?t allow multiple listeners to be add.
d.none


(4)
what will be printed when you execute the following code? 

class x 
{
  y b = new y();
  x() 
 { 
   system.out.print("x"); 
  }
} 

class y 
{
    y() 
   { 
     system.out.print("y"); 
   }
} 

public class z extends x 
{
   y y = new y(); 
  z() 
 { 
    system.out.print("z"); 
  } 
   public static void main(string[] args) 
  {
               new z();
  }
} 

choices:

a.z
b.yz
c.xyz
d.yxyz


(5)下面关于变量及其范围的陈述哪些是错的。
a.实例变量是类的成员变量。
b.实例变量用关键字static声明。
c.在方法中定义的局部变量在该方法被执行时创建
d.局部变量在使用前必须被初始化。


(6)
which is the most appropriate code snippet that can be inserted at line 18 in the following code?

(assume that the code is compiled and run with assertions enabled)

1.  import java.util.*;

2. 

3.  public class asserttest

4.  {

5.      private hashmap cctld;

6.     

7.      public asserttest()

8.      {

9.          cctld = new hashmap();

10.         cctld.put("in", "india");

11.         cctld.put("uk", "united kingdom");

12.         cctld.put("au", "australia");

13.         // more code... 

14.     }

15.     // other methods ....  

16.     public string getcountry(string countrycode)

17.     {

18.         // what should be inserted here?

19.         string country = (string)cctld.get(countrycode);

20.         return country;

21.     }

22. }

a.assert countrycode != null;
b.assert countrycode != null : "country code can not be null" ;
c.assert cctld != null : "no country code data is available";
d.assert cctld : "no country code data is available";


(7)public class parent {
  int change() {…}
}

class child extends parent {

}

which methods can be added into class child?
a.public int change(){}
b.abstract int chang(){}
c.private int change(){}
d.none


(8)
give the following method:
 public void method( ){
 string a,b;
 a=new string(“hello world”);
 b=new string(“game over”);
 system.out.println(a+b+”ok”);
 a=null;
 a=b;
 system.out.println(a);
 } 
in the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.

a.before line 5
b.before line 6
c.before line 7
d.before line 9


(9)which of the following answer is correct to express the value 8 in octal number?
a.010
b.0x10
c.08
d.0x8


(10)
     1. public class x {
     2. public object m ()  {
     3. object o = new float (3.14f);
     4. object [] oa = new object [1];
     5. oa[0]= o;
     6. o = null;
     7. oa[0] = null;
     8.return o;
     9. }
     10.} 
     when is the float object created in line 3, eligible for garbage collection? 

a.just after line 5
b.just after line 6
c.just after line 7
d.just after line 8(that is, as the method returns)


(11)math.round(-11.5)等於多少?
a.-11
b.-12
c.-11.5
d.none


(12)use the operator “>>” and “>>>”. which statement is true?

a.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 0000 1010 0000 0000 0000 0000 0000 0000
b.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 1111 1010 0000 0000 0000 0000 0000 0000
c.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 0000 0000 0000 0000 0000 0000 0000 0000
d.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 1111 1010 0000 0000 0000 0000 0000 0000


(13)鉴于java的特点,它最适合的计算环境是
a.并行计算环境
b.分布式计算环境
c.高强度计算环境
d.开放式计算环境


(14)
given the following class definition:
class a{
protected int i;
a(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this class?
select valid answer: 

a.class b{ }
b.class b extends a{ }
c.class b extends a{ b(){system.out.println(“i=”+i);} }
d.class b{ class a{} }


(15)假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
a.9
b.-2
c.-1
d.8


(16)
what will be the result of executing the following code? 

// filename; superclassx.java

package packagex; 

public class superclassx

{

protected void superclassmethodx()

{

}

int superclassvarx;

} 

 

// filename subclassy.java

1.package packagex.packagey;

2.

3.public class subclassy extends superclassx

4.{

5.superclassx objx = new subclassy();

6.subclassy objy = new subclassy();

7.void subclassmethody()

8.{

9.objy.superclassmethodx();

10.int i;

11.i = objy.superclassvarx;

12.}

13.} 

choices:

a.compilation error at line 5
b.compilation error at line 9
c.runtime exception at line 11
d.none of these


(17)
what is the result when you compile and run the following code? 

public class test

{ 

public void method()

{

for(int i = 0; i < 3; i++)

       {

       system.out.print(i);

       }

       system.out.print(i);

}

} 

choices:

a.0122
b.0123
c.compilation error
d.none of these


(18)
what results from attempting to compile and run the following code? 

public class ternary

{

public static void main(string args[])

{

int a = 5;

system.out.println("value is - " + ((a < 5) ? 9.9 : 9));

}

} 

choices:

a.prints: value is - 9
b.compilation error
c. prints: value is - 5
d.none of these


(19)a class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. what should be done to achieve this?

a.the variable should be marked public
b.the variable should be marked private
c.the variable should be marked protected
d.the variable should have no special access modifier


(20)
string s=”example string”;which operation is not legal?

a.int i=s.length();
b.s[3]=”x”;
c.string short_s=s.trim();
d.string t=”root”+s;


(21)
given the following class definition:
class a{
protected int i;
a(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this class?
select valid answer: 

a.class b{ }
b.class b extends a{ }
c.class b extends a{ b(){system.out.println(“i=”+i);} }
d.class b{ class a{} }


(22)use the operator “>>” and “>>>”. which statement is true?

a.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 0000 1010 0000 0000 0000 0000 0000 0000
b.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 1111 1010 0000 0000 0000 0000 0000 0000
c.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 0000 0000 0000 0000 0000 0000 0000 0000
d.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 1111 1010 0000 0000 0000 0000 0000 0000


(23)
give the following java class:
public class example{
public static void main(string args[]){
static int x[] = new int[15];
system.out.println(x[5]);
}
}
which statement is corrected?

a.when compile, some error will occur.
b.when run, some error will occur.
c.output is zero.
d.output is null.


(24)a class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. what should be done to achieve this?

a.the variable should be marked public
b.the variable should be marked private
c.the variable should be marked protected
d.the variable should have no special access modifier


(25)在下述选项时,没有构成死循环的程序是
a.int i=100 while (1) { i=i%100+1; if (i>100) break; }
b.for (;;);
c.int k=1000; do { ++k; }while(k>=10000);
d.int s=36; while (s);--s;


(26)鉴于java的特点,它最适合的计算环境是
a.并行计算环境
b.分布式计算环境
c.高强度计算环境
d.开放式计算环境


(27)which code fragments would correctly identify the number of arguments passed via command line to a java application, exclude the name of the class that is being invoke.
a.int count = args.length;
b.int count = args.length-1;
c.int count=0; while(args[count]!=null) count++;
d.int count=0;while (!(args[count].equals(“”))) count++;


(28)假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
a.9
b.-2
c.-1
d.8


(29)which are not java keywords?

a.true
b.const
c.super
d.void


(30)
select valid identifier of java:

a.%passwd
b.3d_game
c.$charge
d.this


(31)
which is the most appropriate code snippet that can be inserted at line 18 in the following code?

(assume that the code is compiled and run with assertions enabled)

1.  import java.util.*;

2. 

3.  public class asserttest

4.  {

5.      private hashmap cctld;

6.     

7.      public asserttest()

8.      {

9.          cctld = new hashmap();

10.         cctld.put("in", "india");

11.         cctld.put("uk", "united kingdom");

12.         cctld.put("au", "australia");

13.         // more code... 

14.     }

15.     // other methods ....  

16.     public string getcountry(string countrycode)

17.     {

18.         // what should be inserted here?

19.         string country = (string)cctld.get(countrycode);

20.         return country;

21.     }

22. }

a.assert countrycode != null;
b.assert countrycode != null : "country code can not be null" ;
c.assert cctld != null : "no country code data is available";
d.assert cctld : "no country code data is available";


(32)
what happens when you try to compile and run the following program?
class mystery{
string s;
public static void main(string[] args){
mystery m=new mystery();
m.go();
}
void mystery(){
s=”constructor”;
}
void go(){
system.out.println(s);
}
}

a.this code compliles but throws an exception at runtime
b.this code runs but nothing appears in the standard output
c.this code runs and “constructor” in the standard output
d.this code runs and writes ”null” in the standard output


(33)math.round(-11.5)等於多少?
a.-11
b.-12
c.-11.5
d.none


(34)
what will be printed when you execute the following code? 

class x 
{
  y b = new y();
  x() 
 { 
   system.out.print("x"); 
  }
} 

class y 
{
    y() 
   { 
     system.out.print("y"); 
   }
} 

public class z extends x 
{
   y y = new y(); 
  z() 
 { 
    system.out.print("z"); 
  } 
   public static void main(string[] args) 
  {
               new z();
  }
} 

choices:

a.z
b.yz
c.xyz
d.yxyz


(35)
what will happen when you attempt to compile and run the following code?

(assume that the code is compiled and run with assertions enabled.)

public class asserttest{

public void methoda(int i){

assert i >= 0 : methodb();

system.out.println(i);

}

public void methodb(){  

system.out.println("the value must not be negative");

}

public static void main(string args[]){

asserttest test = new asserttest();

test.methoda(-10); 

}

}

a.it will print -10
b.it will result in assertionerror showing the message-“the value must not be negative”.
c.the code will not compile.
d.none of these.


(36) which of the following statements are true?
a.the automatic garbage collection of the jvm prevents programs from ever running out of memory
b.a program can suggest that garbage collection be performed and force it
c.garbage collection is platform independent
d.an object becomes eligible for garbage collection when all references denoting it are set to null.


(37)which fragments are not correct in java source file?
a.package testpackage; public class test{//do something...}
b.import java.io.*; package testpackage; public class test{// do something...}
c.import java.io.*; class person{// do something...} public class test{// do something...}
d.import java.io.*; import java.awt.*; public class test{// do something...}


(38)关于垃圾收集的哪些叙述是对的。
a.程序开发者必须自己创建一个线程进行内存释放的工作。
b.垃圾收集将检查并释放不再使用的内存。
c.垃圾收集允许程序开发者明确指定并立即释放该内存。
d.垃圾收集能够在期望的时间释放被java对象使用的内存。


(39)which statement about the garbage collection mechanism are true?
a.garbage collection require additional programe code in cases where multiple threads are running.
b.the programmer can indicate that a reference through a local variable is no longer of interest.
c.the programmer has a mechanism that explicity and immediately frees the memory used by java objects.
d.the garbage collection mechanism can free the memory used by java object at explection time.


(40)设有变量说明语句int a=1,b=0;
则执行以下程序段的输出结果为( )。
switch (a)
{
case 1:
switch (b)
{
case 0:printf("**0**");break;
case 1:printf("**1**");break;
}
case 2:printf("**2**");break;
}
printf("\n");
a.**0**
b.**0****2**
c.**0****1****2**
d.有语法错误


(41)
which is the most appropriate code snippet that can be inserted at line 18 in the following code?

(assume that the code is compiled and run with assertions enabled)

1.  import java.util.*;

2. 

3.  public class asserttest

4.  {

5.      private hashmap cctld;

6.     

7.      public asserttest()

8.      {

9.          cctld = new hashmap();

10.         cctld.put("in", "india");

11.         cctld.put("uk", "united kingdom");

12.         cctld.put("au", "australia");

13.         // more code... 

14.     }

15.     // other methods ....  

16.     public string getcountry(string countrycode)

17.     {

18.         // what should be inserted here?

19.         string country = (string)cctld.get(countrycode);

20.         return country;

21.     }

22. }

a.assert countrycode != null;
b.assert countrycode != null : "country code can not be null" ;
c.assert cctld != null : "no country code data is available";
d.assert cctld : "no country code data is available";


(42)which statement about the garbage collection mechanism are true?
a.garbage collection require additional programe code in cases where multiple threads are running.
b.the programmer can indicate that a reference through a local variable is no longer of interest.
c.the programmer has a mechanism that explicity and immediately frees the memory used by java objects.
d.the garbage collection mechanism can free the memory used by java object at explection time.


(43) consider the class hierarchy shown below:

--------------------------------------------------------------------

class fourwheeler implements drivingutilities

class car extends fourwheeler

class truck extends fourwheeler

class bus extends fourwheeler

class crane extends fourwheeler

----------------------------------------------------------------------



consider the following code below:

1.drivingutilities du;

2.fourwheeler fw;

3.truck mytruck = new truck();

4.du = (drivingutilities)mytruck;

5.fw = new crane();

6.fw = du;

which of the statements below are true?

choices:
a.line 4 will not compile because an interface cannot refer to an object.
b.the code will compile and run.
c.the code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed.
d.the code will compile if we put an explicit cast at line 6 but will throw an exception at runtime.


(44)
string s=”example string”;which operation is not legal?

a.int i=s.length();
b.s[3]=”x”;
c.string short_s=s.trim();
d.string t=”root”+s;


(45)
下述程序代码中有语法错误的行是(  )。
int i,ia[10],ib[10];      /*第一行*/
for (i=0;i<=9;i++)        /*第2行*/
  ia[i]=0;          /*第3行*/
ib=ia;    /*第4行*/

a.第1行
b.第2行
c.第3行
d.第4行


(46)math.round(11.5)等於多少?
a.11
b.12
c.11.5
d.none


(47)
what will happen when you attempt to compile and run the following code? 

class base 

{

int i = 99; 

public void amethod()

{

       system.out.println("base.amethod()");

     }

     base()

{

     amethod();

     }

} 

public class derived extends base

{

int i = -1;

       

public static void main(string argv[])

{

     base b = new derived();

       system.out.println(b.i);

       b.amethod();

     } 

     public void amethod()

{

       system.out.println("derived.amethod()");

     } 

} 

choices:

a.derived.amethod() -1 derived.amethod()
b.derived.amethod() 99
c.compile time error
d.derived.amethod()


(48)
give the following java class:
public class example{
public static void main(string args[]){
static int x[] = new int[15];
system.out.println(x[5]);
}
}
which statement is corrected?

a.when compile, some error will occur.
b.when run, some error will occur.
c.output is zero.
d.output is null.


(49)假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
a.9
b.-2
c.-1
d.8


(50) which of the following statements are true?
a.the automatic garbage collection of the jvm prevents programs from ever running out of memory
b.a program can suggest that garbage collection be performed and force it
c.garbage collection is platform independent
d.an object becomes eligible for garbage collection when all references denoting it are set to null.


(51)设有变量说明语句int a=1,b=0;
则执行以下程序段的输出结果为( )。
switch (a)
{
case 1:
switch (b)
{
case 0:printf("**0**");break;
case 1:printf("**1**");break;
}
case 2:printf("**2**");break;
}
printf("\n");
a.**0**
b.**0****2**
c.**0****1****2**
d.有语法错误


(52)
public class x{

   public object m(){

      object o = new float(3.14f);//line 3

      object [] oa = new object[1];//line 4

      oa[0] = o;//line 5

      o=null;//line 6

      return oa[0];//line 7

     }

}
when is the float object, created in line 3,eligible for garbage collection?

a.just after line 5.
b.just after line 6
c.just after line 7(that is,as the method returns)
d.never in this method


(53)使用 jdbc 可以做到的是
a.把二进制代码传送到任何关系数据库中
b.把 java 源代码传送到任何关系数据库中
c.把表单信息传送到任何关系数据库中
d.很容易地把 sql 语句传送到任何关系数据库中


(54)which of the following statements are not legal?

a.long l = 4990;
b.int i = 4l;
c.double d = 34.4;
d.double t = 0.9f.


(55)public class parent {
  int change() {…}
}

class child extends parent {

}

which methods can be added into class child?
a.public int change(){}
b.abstract int chang(){}
c.private int change(){}
d.none


(56)
give the following java class:
public class example{
static int x[]=new int[15];
public static void main(string args[]){
system.out.println(x[5]);
}
}
which statement is corrected?

a.when compile, some error will occur.
b.when run, some error will occur.
c.output is zero.
d.output is null.


(57)
what will be the result of executing the following code? 

// filename; superclassx.java

package packagex; 

public class superclassx

{

protected void superclassmethodx()

{

}

int superclassvarx;

} 

 

// filename subclassy.java

1.package packagex.packagey;

2.

3.public class subclassy extends superclassx

4.{

5.superclassx objx = new subclassy();

6.subclassy objy = new subclassy();

7.void subclassmethody()

8.{

9.objy.superclassmethodx();

10.int i;

11.i = objy.superclassvarx;

12.}

13.} 

choices:

a.compilation error at line 5
b.compilation error at line 9
c.runtime exception at line 11
d.none of these


(58)which statements about java code security are not true?
a.the bytecode verifier loads all classes needed for the execution of a program.
b.executing code is performed by the runtime interpreter.
c.at runtime the bytecodes are loaded, checked and run in an interpreter.
d.the class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.


(59)math.round(-11.5)等於多少?
a.-11
b.-12
c.-11.5
d.none


(60)
what will be printed when you execute the following code? 

class x 
{
  y b = new y();
  x() 
 { 
   system.out.print("x"); 
  }
} 

class y 
{
    y() 
   { 
     system.out.print("y"); 
   }
} 

public class z extends x 
{
   y y = new y(); 
  z() 
 { 
    system.out.print("z"); 
  } 
   public static void main(string[] args) 
  {
               new z();
  }
} 

choices:

a.z
b.yz
c.xyz
d.yxyz


(61)
what will happen when you attempt to compile and run the following code? 

int output = 10;

boolean b1 = false; 

if((b1 == true) && ((output += 10) == 20))

{

   system.out.println("we are equal " + output);

} 

else

{

   system.out.println("not equal! " + output);

} 

choices:

a.compilation error, attempting to perform binary comparison on logical data type
b.compilation and output of "we are equal 10".
c.compilation and output of "not equal! 20".
d.compilation and output of "not equal! 10".


(62)which code fragments would correctly identify the number of arguments passed via command line to a java application, exclude the name of the class that is being invoke.
a.int count = args.length;
b.int count = args.length-1;
c.int count=0; while(args[count]!=null) count++;
d.int count=0;while (!(args[count].equals(“”))) count++;


(63)which of the following statements are not legal?

a.long l = 4990;
b.int i = 4l;
c.double d = 34.4;
d.double t = 0.9f.


(64)在下述选项时,没有构成死循环的程序是
a.int i=100 while (1) { i=i%100+1; if (i>100) break; }
b.for (;;);
c.int k=1000; do { ++k; }while(k>=10000);
d.int s=36; while (s);--s;


(65)
the following code is entire contents of a file called example.java,causes precisely one error during compilation:
 class subclass extends baseclass{
 }
 class baseclass(){
 string str;
 public baseclass(){
 system.out.println(“ok”);}
 public baseclass(string s){
 str=s;}}
 public class example{
 public void method(){
 subclass s=new subclass(“hello”);
 baseclass b=new baseclass(“world”);
 }
 }

which line would be cause the error? 

a.9
b.10
c.11
d.12


(66)
下述程序代码中有语法错误的行是(  )。
int i,ia[10],ib[10];      /*第一行*/
for (i=0;i<=9;i++)        /*第2行*/
  ia[i]=0;          /*第3行*/
ib=ia;    /*第4行*/

a.第1行
b.第2行
c.第3行
d.第4行


(67)
what will happen when you attempt to compile and run the following code?

(assume that the code is compiled and run with assertions enabled.)

public class asserttest{

public void methoda(int i){

assert i >= 0 : methodb();

system.out.println(i);

}

public void methodb(){  

system.out.println("the value must not be negative");

}

public static void main(string args[]){

asserttest test = new asserttest();

test.methoda(-10); 

}

}

a.it will print -10
b.it will result in assertionerror showing the message-“the value must not be negative”.
c.the code will not compile.
d.none of these.


(68)
give the following code:
public class example{
public static void main(string args[] ){
int l=0;
do{
system.out.println(“doing it for l is:”+l);
}while(--l>0)
system.out.println(“finish”);
}
}
which well be output: 

a.doing it for l is 3
b.doing it for l is 1
c.doing it for l is 2
d.doing it for l is 0


(69)which statements about java code security are not true?
a.the bytecode verifier loads all classes needed for the execution of a program.
b.executing code is performed by the runtime interpreter.
c.at runtime the bytecodes are loaded, checked and run in an interpreter.
d.the class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.


(70)public class parent {
  int change() {…}
}

class child extends parent {

}

which methods can be added into class child?
a.public int change(){}
b.abstract int chang(){}
c.private int change(){}
d.none


(71)
give the following java source fragement:
//point x
public class interesting{
//do something
}
which statement is correctly java syntax at point x? 

a.public class myclass{//do other thing…}
b.static int pi=3.14
c.class myclass{//do something…}
d.none


(72)math.round(11.5)等於多少?
a.11
b.12
c.11.5
d.none


(73)下面关于变量及其范围的陈述哪些是错的。
a.实例变量是类的成员变量。
b.实例变量用关键字static声明。
c.在方法中定义的局部变量在该方法被执行时创建
d.局部变量在使用前必须被初始化。


(74)which is the main() method return of a application?
a.string
b.byte
c.char
d.void


(75)
what happens when you try to compile and run the following program?
class mystery{
string s;
public static void main(string[] args){
mystery m=new mystery();
m.go();
}
void mystery(){
s=”constructor”;
}
void go(){
system.out.println(s);
}
}

a.this code compliles but throws an exception at runtime
b.this code runs but nothing appears in the standard output
c.this code runs and “constructor” in the standard output
d.this code runs and writes ”null” in the standard output


(76)
give the code fragment:
if(x>4){
system.out.println(“test 1”);}
else if (x>9){
system.out.println(“test 2”);}
else {
system.out.println(“test 3”);}
which range of value x would produce of output “test 2”? 

a.x<4
b.x>4
c.x>9
d.none


(77)
what is the result when you compile and run the following code? 

public class test

{ 

public void method()

{

for(int i = 0; i < 3; i++)

       {

       system.out.print(i);

       }

       system.out.print(i);

}

} 

choices:

a.0122
b.0123
c.compilation error
d.none of these


(78)软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序?
a.计划阶段、开发阶段、运行阶段
b.设计阶段、开发阶段、编码阶段
c.设计阶段、编码阶段、维护阶段
d.计划阶段、编码阶段、测试阶段


(79)
     1. public class x {
     2. public object m ()  {
     3. object o = new float (3.14f);
     4. object [] oa = new object [1];
     5. oa[0]= o;
     6. o = null;
     7. oa[0] = null;
     8.return o;
     9. }
     10.} 
     when is the float object created in line 3, eligible for garbage collection? 

a.just after line 5
b.just after line 6
c.just after line 7
d.just after line 8(that is, as the method returns)


(80)a class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. what should be done to achieve this?

a.the variable should be marked public
b.the variable should be marked private
c.the variable should be marked protected
d.the variable should have no special access modifier


(81) 第一题:将一个n进制数转换成m进制数。

第二题: string a="2007-11-01"; 用什么方法转换成 "2007-1101";


第三题:
string a="abcd";
string b="abcd";
如何判断两个字符串相等,如果为ture的话 输出ok
如:
if(a这里怎么写b){
system.out.println("ok");
}else{
system.out.println("false");
}


第四题:
用javascript验证重复提交 如admin


第五题:
如何判断两个字符串相等
答:a==b, a.equals(b);


第六题:
接口之间继承所用的关键字为?
a extends
b implements


第七题:
建立一个支持自动排序的类,实现哪个接口
a comparable
b comparator
c sortable
d sortator


第八题:
transient关键字的作用?
a 使变量序列化
b 使变量不序列化
c 使变量不依靠类的实例
d 都不是


第九题:
public class printme
{
public void do(int n);
system.out.println(n+n);
}
public static void main(string[] args){
new printme().do('a');
}
}

a aa
b 130
c 编译出错


第十题:
system.out.println("12345".valueof("54321"));

a 编译出错
b 12345 54321
c 54321


第十一题:
数据结构类自动排序
a arraylist
b linkedlist
c hashset
d treeset


第十二题:
以下哪个类可以取得java.sql.databasemetadate

a java.sql.connection
b java.sql.resultset
c java.sql.drivermanager
d java.sql.driver


第十三题:
create user
( no int primary key,
name varchar2(20),
salary varchar2(20)
);

sql语句 select name,salary,no from user
哪个取不了rs的第1列
a rs.getstring(0);
b rs.getstring(1);
c rs.getstring("name");


第十四题:
ejb timer service 可以与以下哪种bean一起使用?
a cmp entitybeans
b bmp与cmp entitybeans
c messagedriverbeans
d b和c
e a和c
f 以上都不是


第十四题:
ejb timer objects是无状态的对象,与stateless sessionbeans有相同特性吗?
a ture
b false


第十五题:
哪个类型的ejb用来表示业务对象?
a javax.ejb.enterprisebean
b javax.rmi.remote
c javax.ejb.session
d javax.ejb.entitybean


第十六题:
哪个类的ejb表示应用过程的状态信息
a javax.ejb.enterprisebean
b javax.rmi.remote
c javax.ejb.session
d javax.ejb.entitybean


第十七题:
为了客户端要调用ejb的方法,哪个接口必须被实现?
a javax.ejb.entitybean
b javax.ejb.ejbhome
c javax.ejb.ejbobject
d javax.rmi.remote


第十七题:
ejb用什么来和容器传递运行时上下信息?
a 容器提供javax.ejb.ejbcontext
b jndi环境上下文
c 容器提供javax.ejb.ejbhome
d 容器提供javax.ejb.ejbmetadata


第十八题:
bmp与cmp区别是什么?

a bmpbean实现ejbload().ejbstore()
b bmpbean可以实现数据持久到自定义的数据存储地
c bmpbean自己负责持久化数据到数据存储地
d 以上皆是


第十九题:
为jms消息系统开发的mdb在哪个方法里实现业务逻辑?
a setsessioncontext
b onmessage
c ejbremove
d setmessagedrivercontext
e 自定义方法


第二十题:
客户端是通过哪个接口来建立,查找,删除ejb的?

a javax.rmi.remote
b javax.ejb.ejbhome
c javax.ejb.ejbobject
d javax.ejb.entitybean


第二十一题:
jms几种消息传递方式?


第二十二题:
以下哪个不属于jms消息格式
a bytesmessage
b mapmessage
c objectmessage
d streammessage
e textmessage
f 以上都是


第二十三题:
实现异步消息传输,必须实现以下哪个接口?

a javax.jms.messageconsumer
b javax.jms.messageproduct
c javax.jms.messagelistener
d javax.jms.messagesession


第二十四题:
以下哪个类可控制jms事务
a javax.jms.session
b javax.jms.connection
c javax.jms.message
d javax.jms.xacconnection


第二十五题:
如何取得一个jmsdestination?

a 通过jndi取得
b 通过参数传递
c 通过实例化
d class.forname("destination name");



来源:笔试网 http://www.ipmao.com/ ;
面试网 http://www.mianshiwang.com/
粤ICP备08124962号