java软件开发工程师笔试题docWord格式.docx
《java软件开发工程师笔试题docWord格式.docx》由会员分享,可在线阅读,更多相关《java软件开发工程师笔试题docWord格式.docx(9页珍藏版)》请在冰豆网上搜索。
8
2:
Exhibit:
1.publicelasstest(
2.privatestaticintj=0;
3.
4.privatestaticbooleanmethodB(intk)(
5.j+二k;
6.returntrue;
6.)
7.
8.publicstaticvoidmethodA(inti){
9.booleanb:
10.b=ill.b=il2.)
13.
14.publicstaticvoidmain(Stringargs[]}(
15.methodA(0);
16.(j):
17.)
18.)
Whatistheresuit?
programprints“0”
programprints“4’’
programprints“8”
programprints“12”
3:
Whatiswrittentothestandardoutputgiventhefollowingstatement:
(4|7);
Se1ecttherightanswer:
4:
SelectvalididentifierofJava:
Selectvalididentifierofjava:
A.%passwd
_game
C.$charge
5:
设有变量说明语句inta=1,b=0;
则执行以下程序段的输出结果为0。
switch(a)
{
case1:
switch(b)
case0:
printf(〃氺氺0氺氺〃);
break;
easel:
printf(〃氺氺1氺氺〃);
break;
}
case2:
printf(〃氺氺2氺氺〃);
break;
printf(//z/):
B.氺氺0氺氺氺氺2氺氺
C.氺氺0氺氺氺氺1氺氺氺氺2氺氺
D.有语法错误
6:
Inthefollowingpiecesofcode,which
onewillcompilewithoutanyerror?
sbl=z/abcd/z;
b=newBoolean(〃abcd〃);
:
byteb=255;
fl=;
7:
Whatistheresultwhenyoucompileandrunthefollowingeode?
publicclassThrowsDemo
staticvoidthrowMethod()
(〃InsidethrowMethod,);
thrownewIllegalAccessException("
demo"
);
publicstaticvoidmain(Stringargs口)
throwMethodO:
catch(IllegalAccessExceptione)
("
CaughV+e);
Choices:
Whatistheresultwhenyoucompileandrunthefollowingeode?
publicclassThrowsDemo
staticvoidthrowMethod()
(〃InsidethrowMethod,);
thrownewlllegalAccessException("
publicstaticvoidmain(Stringargs口)
throwMethod():
catch(IllegalAccessExceptione)
CaughV'
+e);
Choices:
error
successfully,nothingisprinted.
throwMethod.followedbycaught:
:
demo
8:
Whichofthefollowingstatementsarenotlega1?
1=4990;
i=4L;
d=;
t=
9:
Givethefollowingjavaclass:
publicclassExample{
publicstaticvoidmain(Stringargs[]){staticintx[]=newint[15];
(x[5]);
Whichstatementiscorrected?
Givethefollowingjavaclass:
publicclassExample{
publiestatievoidmain(Stringargs[]){staticintx[]=newint[15]:
Whichstatementiscorrected?
compile,someerrorwilloccur.run,someerrorwil1occur.
iszero.
isnul1.
10:
下面关于变量及其范围的陈述哪些是错的。
A.实例变量是类的成员变量。
B.实例变量用关键字static声明。
C.在方法中定义的局部变量在该方法被执行时创建
D.局部变量在使用前必须被初始化。
11:
publicclassX{
publicObjectmO{
0bjecto=newFloat();
//line3
0bject口oa=newObject[1];
//line4oa[0]=o;
//line5o=nu11;
//line6returnoa[0];
//line7
WhenistheFloatobject,createdinline3,eligibleforgarbagecollection?
publicclassX{publicObjectm(){
Objecto=newFloat();
//line3
Object[]oa=newObject[1];
//line4oa[0]=o;
//line6returnoa[0];
//line7}
WhenistheFloatobject,ereatedinline3,eligibleforgarbagecollection?
afterline5.
afterline6
afterline7(thatis,asthemethodreturns)inthismethod
12:
Whichisthemostappropriatecodesnippetthatcanbeinsertedatlinel8inthefollowingcode?
(Assumethatthecodeiscompiledandrunwithassertionsenabled)
1.import氺;
2.
2.publicelassAssertTest
3.{
4.privateHashMapcctld:
6.
7.publicAssertTest()
8.{
9.cctld=newHashMap();
10.CirT,"
India"
11.(〃uk〃,〃UnitedKingdom〃);
12.(〃au〃,〃Australia〃);
13.//morecode…
14.}
15.//othermethods•…
16.publicStringgetCountry(StringcountryCode)
17.{
18.//Whatshouldbeinsertedhere?
19.Stringcountry=(String)(countryCode);
20.returncountry;
21.}
22.}
Whichisthemostappropriatecodesnippetthatcanbeinsertedatlinel8inthefollowingcode?
(Assumethatthecodeiscompiledandrunwithassertionsenabled)
1.import氺;
3.publicclassAssertTest
4.{
5.privateHashMapcctld;
7.publicAssertTest()
9.cctld=newHashMap():
10.("
in"
"
11.(〃uk〃,〃UnitedKingdom〃);
12.(〃aiT,"
Australiaz/):
13.//morecode…
14.}
15.//othermethods….
16.publicStringgetCountry(StringcountryCode)
18.//Whatshouldbeinsertedhere?
19.Stringcountry=(String)(countryCode);
20.returncountry:
countryCode!
=null:
countryCode!
=nu11:
Z/Countrycodecannotbenull”;
cctld!
"
Nocountrycodedataisavailable"
;
cctld:
Z/Nocountrycodedataisavailable"
13:
Givethefollowingcode:
publicclassExample{
publicstaticvoidmain(Stringargs[]){int1=0;
do{
(“Doingitforlis:
”+1);
}whi1e(—1>
0)
(“Finish”);
Whichwellbeoutput:
Givethefoliowingcode:
publicclassExampie{
publicstaticvoidmain(Stringargs口){intl=0;
(“Doingitforlis:
}while(—1>
0)
Whichwellbeoutput:
itforlis3itforlislitforlis2
itforlisO
14:
WhichstatementsaboutJavacodesecurityarenottrue?
bytecodeverifierloadsallclassesneededfortheexecutionofaprogram.
codeisperformedbytheruntimeinterpreter.
runtimethebytecodesareloaded,checkedandr
uninaninterpreter.
classloaderaddssecuritybyseparatingthenamespacesfortheclassesofthelocalfilesystemfromthoseimportedfromnetworksources.
15:
Aclassdesignrequiresthatamembervariableshouldbeaccessibleonlybysamepackage,whichmodiferwordshouldbeused?
modifer
16:
Character流与Byte流的区别是
A.每次读入的字节数不同
B.前者带有缓冲,后者没有
c.前者是块读写,后者是字节读写
D.二者没有区别,可以互换使用
简答题
//
17:
找出两个字符串中最大子字符串,如"
abractyey
t〃,"
dgdsaeactyey〃的最大子串为〃actyet
18:
假设你有一个用1001个整数组成的数组,这些整数是任意排列的,但是你知道所有的整数都在1到1000(包括1000)之间。
此外,除一个数字出现两次外,其他所有数字只出现一次。
假设你只能对这个数组做一次处理,用一种算法找出重复的那个数字。
如果你在运算中使用了辅助的存储方式,那么你能找到不用这种方式的算法吗?
20:
使用tomcat部署应用程序遇到过吗?
如何解决的。
21:
请写一个java程序实现数据库缓冲池的功能?
22:
有200个正整数,且每个数均在1000至9999之间请编制函数,其函数的功能是:
要求按每个数的后三位的大小进行升序排列,然后取出满足此条件的前10个数依次存入数组bb中,如果后三位的数值相等,则按原先的数值进行降序排列。
23:
AnonymouslnnerClass(匿名内部类)是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?
24:
找出字符串A中包含的字符可以进行的所有不同组合。
例如:
abccd中,ab,ac,bc,cc,abd等都是可能的组合。
25:
下面的代码在绝大部分时间内都运行得很正常,请问在什么情况下会出现问题?
问题的根源在哪里?
import:
publicclassStack{
LinkedListlist=newLinkedList();
publicsynchronizedvoidpush(Objectx){
synchronized(list){
(x);
notify():
publicsynchronizedObjectpop()throwsException{synchronized(list){if(Owait():
return();