limmimm54>試卷(2020/02/18)

OJCP(SCJP)題庫 下載題庫

-1910 年 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 51-100#83056 

選擇:46題,非選:4題
立即測驗 
我要補題 回報試卷錯誤
1.重新載圖51  5e4b62ebd90ad.jpg
Which statement is true about the classes and interfaces?
(A) Compilation will succeed for all classes and interfaces.
(B) Compilation of class C will fail because of an error in line 2.
(C) Compilation of class C will fail because of an error in line 6.
(D) Compilation of class AImpl will fail because of an error in line 2. .


2.重新載圖54 5e4b6568da408.jpgWhat can directly access and change the value of the variable name?
(A) any class
(B) only the Target class
(C) any class in the test package
(D) any class that extends Target .


3.重新載圖55  5e4ca27ef3f6e.jpg
What is the result?
(A) 0, 0, 0
(B) 150, 60, 0
(C) Compilation fails.
(D) 150, 150, 150
(E) An exception is thrown at runtime. .


4.重新載圖56  5e4ca2a777369.jpgWhich is true?
(A) if line 10 is removed, the compilation succeeds.
(B) if line 11 is removed, the compilation succeeds.
(C) if line 12 is removed, the compilation succeeds.
(D) if line 13 is removed, the compilation succeeds.
(E) More than one line must be removed for compilation to succeed.
.


5.重新載圖57  5e4ca38bb1053.jpg
What is the result?
(A) Canada
(B) null Canada
(C) Canada null
(D) Canada Canada
(E) Compilation fails due to an error on line 26. 
(AB) Compilation fails due to an error on line 29.
.


6.重新載圖58  5e4ca427be42c.jpg
Which code, inserted at line 16, will cause a java.lang.ClassCastException?
(A) Alpha a = x;
(B) Foo f = (Delta)x;
(C) Foo f = (Alpha)x;
(D) Beta b = (Beta)(Alpha)x; .


7.重新載圖59  5e4ca456eec0b.jpg
Assume the current directory is bigProject, what it the result?
(A) If the compile is successful, Utils.class is added to the source directory.
(B) The compiler returns an invalid flag error.
(C) If the compile is successful, Utils.class is added to the classes directory.
(D) If the compile is successful, Utils.class is added to the bigProject directory. .


8.重新載圖60  5e4ca48931245.jpg
And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory). 
Which two java commands entered at the command line will run MainClass? (Choose two.)
(A) java MainClass if run from the /apps directory
(B) java com.company.application.MainClass if run from the /apps directory
(C) java -classpath /apps com.company.application.MainClass if run from any directory
(D) java-classpath . MainClass if run from the /apps/com/company/application directory
(E) java -classpath /apps/com/company/application:. MainClass if run from the /apps directory 
(AB) java com.company.application.MainClass if run from the /apps/com/company/application directory
.


9.重新載圖61  5e4ca4e342a8f.jpg
If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?
(A) add import animals. mammals.*; at line 2 in Salmon.java
(B) add import animals.fish.*; at line 2 in GrizzlyBearjava
(C) add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
(D) add import animals. mammals.GrizzlyBear*; at line 2 in Salmon.java .


10.重新載圖62  5e4ca5130a2df.jpg
What is the result? 
(A) b 3 
(B) b 8 
(C) b 13 
(D) f 3 
(E) f 8 
(AB) f 13 
(AC) Compilation fails, 
(AD) An exception is thrown at runtime.
.


11.重新載圖63  5e4ca5609712b.jpg
Which three are valid? (Choose three.) 
 1. p0 = p1; 
 2. p1 = p2, 
 3. p2 = p4; 
 4. p2 = (ClassC)p1; 
 5. p1 = (ClassB)p3; 
 6. p2 = (ClassC)p4;
(A) 123
(B) 126
(C) 235
(D) 156
.


12.重新載圖66  5e4ca6a5391dc.jpg
Which two are true? (Choose two.)  
1. The output is mm.  
2. The output is mc.  
3. Component is-a Meter.  
4. Component has-a Meter. 
5. DeluxeThingy is-a Component.  
6. DeluxeThingy has-a Component.
(A) 16
(B) 34
(C) 12
(D) 56
.


13.重新載圖67  5e4ca6ee38e4b.jpg
Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.)
(A) double getSalesAmount() { return 1230.45; }
(B) public double getSalesAmount() { return 1230.45; }
(C) private double getSalesAmount() { return 1230.45; }
(D) protected double getSalesAmount() { return 1230.45; } .


14.重新載圖68  5e4ca71e18a79.jpg
How many of these method names follow JavaBean Listener naming rules?
(A) 1
(B) 2
(C) 3
(D) 4
(E) 5 .


15.重新載圖69  5e4ca73bd579b.jpg
Which three are valid on line 12? (Choose three.)
(A) final
(B) static
(C) native
(D) public
(E) private 
(AB) abstract 
(AC) protected
.


16.重新載圖70  5e4ca77c25bb6.jpg
Given the fully-qualified class names: 
com.foo.bar.Dog 
com.foo.bar.blatz.Book 
com.bar.Car 
com.bar.blatz.Sun 
Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM?
(A) Jar A
(B) Jar B
(C) Jar C
(D) Jar D
(E) Jar E
.


17.重新載圖71 
5e4cad3755d10.jpg
What is the result?
(A) Compilation fails because of an error in line 3.
(B) Compilation fails because of an error in line 7.
(C) Compilation fails because of an error in line 9.
(D) If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.
(E) If you define D e = D(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5. 
(AB) If you define D e = D(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
.


18.重新載圖72 
5e4cad6da6822.jpg
Which statement is true about the class of an object that can reference the variable base?
(A) It can be any class.
(B) No class has access to base.
(C) The class must belong to the geometry package.
(D) The class must be a subclass of the class Hypotenuse.
.


19.重新載圖73 
5e4cad9e093e5.jpg
Which class correctly uses the Data interface and Info class? 

(A)  5e4cade7c4d6b.jpg

(B)  5e4cae0f25e39.jpg

(C)  5e4cae394cd27.jpg

(D)  5e4cae4af1148.jpg

(E)  5e4cae592b816.jpg
(AB)  5e4cae69b8e85.jpg
.


20.重新載圖74 Which two classes correctly implement both the java.lang.Runnable and the java.lang.Cloneable interfaces? (Choose two.) 

(A)  5e4caeb8e2b4c.jpg 

(B)  5e4caeca91eac.jpg 

(C)  5e4caedb2874e.jpg

(D)  5e4caeebe8ef4.jpg

(E)  5e4caefa17435.jpg
.


21.重新載圖75 
5e4caf2c49ff2.jpg
What is the result?
(A) Compilation succeeds.
(B) Exactly one class does NOT compile.
(C) Exactly two classes do NOT compile.
(D) Exactly four classes do NOT compile.
(E) Exactly three classes do NOT compile.
.


22.重新載圖76 
5e4caf5bf397f.jpg
What is the result?
(A) TestA
(B) TestB
(C) Compilation fails.
(D) An exception is thrown at runtime.
.


23.重新載圖77 
5e4caf7b88cc4.jpg
What is the result?
(A) 1 2 3
(B) Compilation fails because of an error in line 12.
(C) Compilation fails because of an error in line 13.
(D) Compilation fails because of an error in line 14.
(E) A ClassCastException is thrown at runtime.
.


24.78 A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose Three.) 
 1. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar. 
 2. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar. 
 3. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class. 
 4. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar. 
 5. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/Paper Book.java 
 6. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar Book.java 7. The JAR file is located at foo/myLib.jar and the Book class is compiled using javac -classpath /foo/myLib.jar Book.java
(A) 123
(B) 247
(C) 567
(D) 147
.

25.重新載圖79 
5e4cafe2907c2.jpg
What is the result of executing XMLMessage.main?
(A) text
(B) Compilation fails.
(C) <msg>text</msg>
(D) An exception is thrown at runtime.
.


26.重新載圖80 
5e4cb00db641e.jpg
What is the result?
(A) w-f
(B) f-p w-f
(C) w-f b-f
(D) f-p w-f b-f
(E) Compilation fails. 
(AB) An exception is thrown at runtime.
.


27.重新載圖81 
5e4cb03036c8b.jpg
What is the result?
(A) The file will compile without error.
(B) Compilation fails. Only line 7 contains an error.
(C) Compilation fails. Only line 12 contains an error.
(D) Compilation fails. Only line 13 contains an error.
(E) Compilation fails. Only lines 7 and 12 contain errors. 
(AB) Compilation fails. Only lines 7 and 13 contain errors. 
(AC) Compilation fails. Lines 7, 12, and 13 contain errors.
.


28.重新載圖82 
5e4cb060a0db2.jpg
What is the result?
(A) Compilation succeeds.
(B) Compilation fails due to multiple errors.
(C) Compilation fails due to an error only on line 20.
(D) Compilation fails due to an error only on line 21.
(E) Compilation fails due to an error only on line 22. 
(AB) Compilation fails due to an error only on line 12.
.


29.重新載圖83 
5e4cb0ad2eb55.jpg
Which three statements are true? (Choose three.) 
 1. Compilation fails. 
 2. The code compiles and the output is 2. 
 3. If lines 16, 17 and 18 were removed, compilation would fail. 
 4. If lines 24, 25 and 26 were removed, compilation would fail. 
 5. If lines 16, 17 and 18 were removed, the code would compile and the output would be 2. 
 6. If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.
(A) 256
(B) 146
(C) 356
(D) 123
.


30.重新載圖84 
5e4cb0e5192c4.jpg
What is the result?
(A) Afoo Afoo
(B) Afoo Bfoo
(C) Bfoo Afoo
(D) Bfoo Bfoo
(E) Compilation fails. 
(AB) An exception is thrown at runtime.
.


31.重新載圖85 
5e4cb1230f2b6.jpg
What is the result?
(A) peep
(B) bark
(C) meow
(D) Compilation fails.
(E) An exception is thrown at runtime.
.


32.重新載圖86 
5e4cb152c5e68.jpg
What are four valid examples of polymorphic method calls? (Choose four.) 
 1. x.a2(); 
 2. z.a2(); 
 3. z.c1(); 
 4. z.a1(); 
 5. y.c1();
 6. x.a1();
(A) 1246
(B) 123456
(C) 2345
(D) 13465
.


33.87 A team of programmers is involved in reviewing a proposed design for a new utility class, After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself. What design issue has the team discovered?
(A) Tight coupling
(B) Low cohesion
(C) High cohesion
(D) Loose coupling
(E) Weak encapsulation (AB) Strong encapsulation .

34.88 Which Three statements are true? (Choose Three.) 
 1. A final method in class X can be abstract if and only if X is abstract. 
 2. A protected method in class X can be overridden by any subclass of X. 
 3. A private static method can be called only within other static methods in class X. 
 4. A non-static public final method in class X can be overridden in any subclass of X. 
 5. A public static method in class X can be called by a subclass of X without explicitly referencing the class X. 
 6. A method with the same signature as a private final method in class X can be implemented in a subclass of X. 
 7. A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.
(A) 123
(B) 456
(C) 256
(D) 1256
.

35.重新載圖89 
5e4cb1c8c57cb.jpg
What two must the programmer do to correct the compilation errors? (Choose two.)
(A) insert a call to this() in the Car constructor
(B) insert a call to this() in the MeGo constructor
(C) insert a call to super() in the MeGo constructor
(D) insert a call to super(vin) in the MeGo constructor
(E) change the wheelCount variable in Car to protected 
(AB) change line 3 in the MeGo class to super.wheelCount = 3;
.


36.重新載圖90 
5e4cb20a6efff.jpg
What is the result?
(A) s 14
(B) s 16
(C) s 10
(D) Compilation fails.
(E) An exception is thrown at runtime.
.


37.91 A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command: 
java games.cards.Poker 
What allows the user to do this?
(A) put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java
(B) put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar
(C) Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar
(D) put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java
(E) put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/*.jar 
(AB) put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar
.

38.重新載圖92 
5e4cb277ac1b0.jpg
Which command line correctly runs Commander?
(A) java Commander
(B) java com.sun.sjcp.Commander
(C) java com/sun/sjcp/Commander
(D) java -cp com.sun.sjcp Commander
(E) java -cp com/sun/sjcp Commander
.


39.重新載圖93 
5e4cb2a2435df.jpg
Which code, inserted at line 14, allows the Sprite class to compile?
(A) Direction d = NORTH;
(B) Nav.Direction d = NORTH;
(C) Direction d = Direction.NORTH;
(D) Nav.Direction d = Nav.Direction.NORTH;
.


40.重新載圖94 
5e4cb2f802276.jpg
Which code fragment inserted at line 19, allows the Rainbow class to compile?
(A) MyColor skyColor = BLUE;
(B) MyColor treeColor = MyColor.GREEN;
(C) if(REDgetRGB() < BLUEgetRGB()){}
(D) Compilation fails due to other error(s) in the code.
(E) MyColor purple = new MyColor(0xff00ff); 
(AB) MyColor purple = MyColor.BLUE + MyColor.RED;
.


41.重新載圖95 
5e4cb3271adcc.jpg
What is the result?
(A) test
(B) null
(C) An exception is thrown at runtime.
(D) Compilation fails because of an error in line 1.
(E) Compilation fails because of an error in line 4. 
(AB) Compilation fails because of an error in line 5.
.


42.重新載圖96 
5e4cb38d0fc1a.jpg
Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?
(A) import utils.*;
(B) static import utils.*;
(C) import utils.Repetition.*;
(D) static import utils.Repetition.*;
(E) import utils.Repetition.twice(); 
(AB) import static utils.Repetition.twice; 
(AC) static import utils.Repetition.twice;
.


43.97 Which statement is true?
(A) A class's finalize() method CANNOT be invoked explicitly.
(B) super.finalize() is called implicitly by any overriding finalize() method.
(C) The finalize() method for a given object is called no more than once by the garbage collector.
(D) The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable. .

44.重新載圖98 
5e4cb3c37c5de.jpg
What is the result?
(A) No output is produced. 1 2 3
(B) No output is produced. 2 3 4
(C) No output is produced. 1 2 3 4
(D) An exception is thrown at runtime. 1 2 3
(E) An exception is thrown at runtime. 2 3 4 
(AB) An exception is thrown at runtime. 1 2 3 4
.


45.重新載圖99 
5e4cb3f7c7557.jpg
When line 14 is reached, how many objects are eligible for the garbage collector?
(A) 0
(B) 1
(C) 2
(D) 3
(E) 4 
(AB) 6
.


46.重新載圖100 
5e4cb4351b5c7.jpg
What is the result?

(A) 12
(B) The code runs with no output.
(C) An exception is thrown at runtime.
(D) Compilation fails because of an error in line 21.
(E) Compilation fails because of an error in line 22. 
(AB) Compilation fails because of an error in line 31.
.


【非選題】
47.52 Place the code fragments in position to complete the Displayable interface. 5e4b64f01638f.jpg


【非選題】
48.53 Insert six modifiers into the code such that it meets all of these requirements:  
1. It must be possible to create instances of Alpha and Beta from outside the packages in which they are defined.  
2. When an object of type Alpha (or any potential subclass of Alpha) has been created, the instance variable alpha may never be changed.  
3. The value of the instance variable alpha must always be "A" for objects of type Alpha. 5e4b651db93be.jpg


【非選題】
49.64 5e4ca5af083ea.jpg


【非選題】
50.65 Replace two of the Modifiers that appear in the Single class to make the code compile. 
Note: Three modifiers will not be used and four modifiers in the code will remain unchanged.5e4ca676e185e.jpg


懸賞詳解

國三理化下第二次

24下列哪一個步驟為演化發生的原動力? (A)同種個體過度的繁殖 (B)適者生存,不適者淘汰 (C)同種個體間具有差異性 (D)同種個體間發生生存競爭 ....

50 x

前往解題

-1910 年 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 51-100#83056-阿摩線上測驗

-1910 年 - SCJP 6.0 認證教戰手冊第二版 SCJP 6.0 認證教戰手冊第二版 認證教戰手冊第二版_題庫 51-100#83056