SCJP认证考试历年真题.pdf
《SCJP认证考试历年真题.pdf》由会员分享,可在线阅读,更多相关《SCJP认证考试历年真题.pdf(30页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、SCJP认证考试历年真题这都是考试原题,有心人可以收集收集,会让你收益匪浅!因为这一套较多,所以我分 将他罗列出来!310-025Leading the way in IT testing and certification tools,Question No:1Given:1.public class test(2.publie static void main(String args)3.int i=OxFFFFFFFl;4.int j=i;5.6.)7.)What is the decimal value of j at line 5?A.0B.1C.14D.-15E.An error
2、at line 3 causes compilation to fail.F.An error at line 4 causes compilation to fail.Answer:DQuestion No:2Given:Integer i=new Integer(42);Long 1=new Long(42);Double d=new Double(42.0);Which two expressions evaluate to True?(Choose Two)A.(i=1)B.(i=d)C.(d=1)D.(i.equals(d)E.(d.equals(i)F.(i.equals(42)A
3、nswer:D,EQuestion No:3E xhibit:1.public class test(2.private static int j=0;3.4.private static boolean methodB(int k)(5.j+=k;6.return true;6.)7.8.public static void methodA(int i)9.boolean b:10.b=i 10 methodB(4);11.b=i 10 methodB(8);12.)13.14.public static void main(String args (15.methodA(0);16.sys
4、tem,out.println(j);17.)18.)What is the result?A.The program prints 0”B.The program prints 4”C.The program prints 8”D.The program prints 12”E.The code does not complete.Answer:BQuestion No:4Given1.Public class test(2.Public static void main(String args)(3.System.out.printin(6 3);4.)5.)What is the out
5、put?Answer:5Question No:5Given:1.publie class Foo 2.public static void main(String 口 args)3.StringBuffer a=new StringBuffer(A”);4.StringBuffer b=new StringBuffer(B );5.operate(a,b);6.system.out.printina+“,”+b;7.)8.static void operate(StringBuffer x,StringBuffery)9.x.append y;10.y=x;1 1.)12.Wha t is
6、the resul t?A.The code compil es a nd prints“A,B”.B.The code compil es a nd prints“A,A”.C.The code compil es a nd prints“B,B”.D.The code compil es a nd prints“AB,B”.E.The code compil es a nd prints“AB,AB”.F.The code does not compil e beca use +ca nnot beoverl oa ded for String Buffer.Answer:DQuestio
7、n No:6Exhibit:1.Publ ic cl a ss test(2.Publ ic sta tic void string Repl a ce(String t e x t)(3.Text=text,repl a ce(,j ,,i);4.)5.6.publ ic sta tic void bufferRepl a ce(String Buffer text)7.text=text,a ppend(C)8.)9.10.public static void main(String args(11.String textString=new String(java”);12.String
8、Buffer text BufferString=new StringBuffer(“java”);13.14.stringReplace(textString);15.BufferReplace(textBuffer);16.17.System.out.printin(textString+textBuffer);18.19.)What is the output?Answer:javajavaCQuestion No:7E xhibit:1.public class test 2.public static void add3(Integer i)3.int val=i.intValue(
9、);4.val+=3;5.i=new Integer(val);6.)7.8.public static void main(String args )9.Integer i=new Integer(0);10.add3(i);11.system,out.printin(i.intValue();12.1 3.)What is the result?A.Compilation will fail.B.The program prints 0”.C.The program prints 3”.D.Compilation will succeed but an exception will bet
10、hrown at line 3.Answer:BQuestion No:8Given:1.public class ConstOver 2.public ConstOver(int x,int y,int z)3.)4.)Which two overload the ConstOver constructor?(ChooseTwo)A.ConstOver()B.Protected int ConstOver()C.Private ConstOver(int z,int y,byte x)D.Public Object ConstOver(int x,int y,int z)E.Public v
11、oid ConstOver(byte x,byte y,byte z)Answer:A,CQuestion No:9Given:1.public class MethodOver 2.public void setVar(int a,int b,float c)3.)4.)Which two overload the setVar method?(Choose Two)A.Private void setVar(int a,float c,int b)B.Protected void setVar(int a,int b,float c)C.Public int setVar(int a,fl
12、oat c,int b)(returna;)D.Public int setVar(int a,int b,float c)(returna;)E.Protected float setVar(int a,int b,float c)(return c;)Answer:A,CQuestion No:10Given:1.class BaseClass 2.Private float x=1.Of;3.protected float getVar()(return x;)4.)5.class Subclass extends BaseClass(6.private float x=2.Of;7./
13、in sert code here8.)Which two are valid examples of method overriding?(Choose Two)A.Float getVar()return x;B.Public float getVar()return x;C.Float double getVar()return x;D.Public float getVar()return x;E.Public float getVar(float f)return f;Answer:B,DQuestion No:11Which two demonstrate an is a”rela
14、tionship?(ChooseTwo)A.public interface Person public class Employee extends Person B.public interface Shape public class Employee extends Shape C.public interface Color public class Employee extends Color D.public class Species public class Animal(private Species species;)E.interface Component Class
15、 Container implements Component(Private Component children;)Answer:D,EQuestion No:12Which statement is true?A.An anonymous inner class may be declared as final.B.An anonymous inner class can be declared as private.C.An anonymous inner class can implement multipleinterfaces.D.An anonymous inner class
16、 can access final variablesin any enclosing scope.E.Construction of an instance of a static inner classrequires an instance of the enclosing outer class.Answer:DQuestion No 13Given:1.package foo;2.3.public class Outer(4.public static class Inner(5.)6.)Which statement is true?A.An instance of the Inn
17、er class can be constructedwith“new Outer.Inner()”B.An instance of the inner class cannot be constructedoutside of package foo.C.An instance of the inner class can only beconstructed from within the outer class.D.From within the package bar,an instance of the innerclass can be constructed with“new i
18、nner。Answer:AQuestion No 14Exhibit:1.public class enclosingone(2.public class insideone 3.)4.public class inertest(5.publie static void main(stringargs)(6.enclosingone eo=new enclosingone();7./insert code here8.)9.)Which statement at line 7 constructs an instance of theinner class?A.InsideOnew ei=eo
19、.new InsideOn();B.Eo.InsideOne ei=eo.new InsideOne();C.InsideOne ei=EnclosingOne.new InsideOne();D.EnclosingOne.InsideOne ei=eo.new InsideOne();Answer:DQuestion No 15Exhibit:1.interface foo 2.int k=0;3.4.5.public class test implements Foo(6.public static void main(String args)(7.int i;8.Test test=ne
20、w test();9.i=test,k;10.i=Test,k;11.i=Foo.k;12.)13.)14.What is the result?A.Compilation succeeds.B.A n error at line 2 causes compilation to fail.C.An error at line 9 causes compilation to fail.D.An error at line 10 causes compilation to fail.E.A n error at line 11 causes compilation to fail.Answer:A
21、Question No 16Given:1./point X2.public class foo(3.public static void main(Stringargs)throwsException 4.printWriter out=new PrintWriter(new5.java.io.outputStreamWriter(System,out),true;6.out.printin(Hello);7.)8.)Which statement at PointX on line 1 allows this codeto compile and run?A.Import java.io.
22、PrintWriter;B.Include java.io.PrintWriter;C.Import java.io.OutputStreamWriter;D.Include java.io.OutputStreamWriter;E.No statement is needed.Answer:AQuestion No 17Which two statements are reserved words in Java?(Choose Two)A.RunB.ImportC.DefaultD.ImplementAnswer:B,CQuestion No 18Which three a re va l
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SCJP 认证 考试 历年
限制150内