Java开发工程师 笔试题Word文档下载推荐.docx
- 文档编号:20019729
- 上传时间:2023-01-15
- 格式:DOCX
- 页数:21
- 大小:20.86KB
Java开发工程师 笔试题Word文档下载推荐.docx
《Java开发工程师 笔试题Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Java开发工程师 笔试题Word文档下载推荐.docx(21页珍藏版)》请在冰豆网上搜索。
Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?
publicclassStatic
{
static
intx=5;
}
staticintx,y;
publicstaticvoidmain(Stringargs[])
x--;
myMethod();
System.out.println(x+y+++x);
publicstaticvoidmyMethod()
y=x+++++x;
}
A.prints:
2
B.prints:
3
C.prints:
7
D.prints:
8
3:
Give
code
fragment:
if(x>
4){
System.out.println(“Test
1”);
else
if
(x>
9){
2”);
3”);
Which
range
of
value
would
produce
output
“Test
2”?
Givethecodefragment:
4){
System.out.println(“Test1”);
elseif(x>
9){
System.out.println(“Test2”);
else{
System.out.println(“Test3”);
Whichrangeofvaluexwouldproduceofoutput“Test2”?
A.x<
4
B.x>
C.x>
9
D.None
4:
Math.round(-11.5)等於多少?
A.-11
B.-12
C.-11.5
D.none
5:
publicclassParent{
intchange(){…}
classChildextendsParent{
WhichmethodscanbeaddedintoclassChild?
A.publicintchange(){}
B.abstractintchang(){}
C.privateintchange(){}
6:
在软件生命周期中,下列哪个说法是不准确的?
A.软件生命周期分为计划、开发和运行三个阶段
B.在计划阶段要进行问题焉醛和需求分析
C.在开发后期要进行编写代码和软件测试
D.在运行阶段主要是进行软件维护
7:
java
class:
Example{
args[]){
x[]
new
int[15];
System.out.println(x[5]);
statement
is
corrected?
Givethefollowingjavaclass:
publicclassExample{
publicstaticvoidmain(Stringargs[]){
staticintx[]=newint[15];
Whichstatementiscorrected?
A.Whencompile,someerrorwilloccur.
B.Whenrun,someerrorwilloccur.
C.Outputiszero.
D.Outputisnull.
8:
假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
}while(b--<
0);
A.9
B.-2
C.-1
D.8
9:
软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序?
A.计划阶段、开发阶段、运行阶段
B.设计阶段、开发阶段、编码阶段
C.设计阶段、编码阶段、维护阶段
D.计划阶段、编码阶段、测试阶段
10:
Base
i
99;
amethod()
System.out.println("
Base.amethod()"
);
Base()
amethod();
Derived
extends
Base
-1;
argv[])
b
Derived();
System.out.println(b.i);
b.amethod();
Derived.amethod()"
classBase
inti=99;
publicvoidamethod()
System.out.println("
}
Base()
amethod();
publicclassDerivedextendsBase
inti=-1;
publicstaticvoidmain(Stringargv[])
Baseb=newDerived();
System.out.println(b.i);
b.amethod();
}
publicvoidamethod()
A.Derived.amethod()-1Derived.amethod()
B.Derived.amethod()99
C.Compiletimeerror
D.Derived.amethod()
11:
this
outline:
private
x;
//rest
body…
Assuming
that
invoked
by
Example,
which
can
made
be
directly
accessible
in
main()
method
Example.java?
Givethisclassoutline:
classExample{
privateintx;
//restofclassbody…
AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyaccessibleinmain()methodofExample.java?
A.Changeprivateintxtopublicintx
B.changeprivateintxtostaticintx
C.Changeprivateintxtoprotectedintx
D.changeprivateintxtofinalintx
12:
most
appropriate
snippet
inserted
at
line
18
(Assume
compiled
with
assertions
enabled)
1.
import
java.util.*;
2.
3.
AssertTest
4.
5.
HashMap
cctld;
6.
7.
AssertTest()
8.
9.
cctld
HashMap();
10.
cctld.put("
in"
"
India"
11.
uk"
United
Kingdom"
12.
au"
Australia"
13.
//
more
code...
14.
15.
other
methods
....
16.
String
getCountry(String
countryCode)
17.
18.
should
here?
19.
country
(String)cctld.get(countryCode);
20.
return
country;
21.
22.
Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode?
(Assumethatthecodeiscompiledandrunwithassertionsenabled)
1.importjava.util.*;
2.
3.publicclassAssertTest
4.{
5.privateHashMapcctld;
6.
7.publicAssertTest()
8.{
9.cctld=newHashMap();
10.cctld.put("
"
11.cctld.put("
UnitedKingdom"
12.cctld.put("
13.//morecode...
14.}
15.//othermethods....
16.publicStringgetCountry(StringcountryCode)
17.{
18.//Whatshouldbeinsertedhere?
19.Stringcountry=(String)cctld.get(countryCode);
20.returncountry;
21.}
22.}
A.assertcountryCode!
=null;
B.assertcountryCode!
=null:
"
Countrycodecannotbenull"
;
C.assertcctld!
Nocountrycodedataisavailable"
;
D.assertcctld:
13:
给出下面的代码片断。
。
下面的哪些陈述为错误的?
1)
create()
2)
Vector
myVect;
3)
myVect
Vector();
4)
1)publicvoidcreate(){
2)VectormyVect;
3)myVect=newVector();
4)}
A.第二行的声明不会为变量myVect分配内存空间。
B.第二行语句创建一个Vector类对象。
C.第三行语句创建一个Vector类对象。
D.第三行语句为一个Vector类对象分配内存空间
14:
source
fragement:
//point
x
Interesting{
//do
something
correctly
Java
syntax
point
x?
Givethefollowingjavasourcefragement:
//pointx
publicclassInteresting{
//dosomething
WhichstatementiscorrectlyJavasyntaxatpointx?
A.publicclassMyClass{//dootherthing…}
B.staticintPI=3.14
C.classMyClass{//dosomething…}
15:
Whichstatementaboutlisteneristrue?
A.Mostcomponentallowmultiplelistenerstobeadded.
B.Ifmultiplelistenerbeaddtoasinglecomponent,theeventonlyaffectedonelistener.
C.Componentdon?
tallowmultiplelistenerstobeadd.
16:
X{
Object
m(){
o
Float(3.14F);
//line
3
[]
oa
Object[1];
4
oa[0]
o;
5
o=null;
6
oa[0];
7
When
Float
object,
created
3,eligible
for
garbage
collection?
publicclassX{
publicObjectm(){
Objecto=newFloat(3.14F);
//line3
Object[]oa=newObject[1];
//line4
oa[0]=o;
//line5
o=null;
//line6
returnoa[0];
//line7
WhenistheFloatobject,createdinline3,eligibleforgarbagecollection?
A.justafterline5.
B.justafterline6
C.justafterline7(thatis,asthemethodreturns)
D.neverinthismethod
17:
printed
execute
X
Y
Y();
X()
{
System.out.print("
X"
Y()
Y"
Z
Z()
Z"
main(String[]
args)
Z();
Whatwillbeprintedwhenyouexecutethefollowingcode?
classX
Yb=newY();
X()
{
System.out.print("
classY
Y()
publicclassZextendsX
Yy=newY();
Z()
publicstaticvoidmain(String[]args)
{
newZ();
A.Z
B.YZ
C.XYZ
D.YXYZ
简答题
18:
swtich是否能作用在byte上,是否能作用在long上,是否能作用在String上?
19:
StaticInnerClass和InnerClass的不同,说得越多越好。
20:
请说出你所知道的线程同步的方法。
21:
一堆数在一个集合中,总共2n个,问如何将这些数分成A,B两分,每分n个,要求A中的数均小于B中的数,需要考虑时间复杂度。
22:
package
test;
FatherClass
FatherClass()
FatherClass
Create"
子类:
test.FatherClass;
ChildClass
ChildClass()
args)
fc
FatherClass();
cc
ChildClass();
输出结果:
packagetest;
publicclassFatherClass
publicFatherClass()
Sy
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Java开发工程师 笔试题 Java 开发 工程师 笔试