呵呵~這當然就是續上次說的另一半啦!希望我這陣子忙著其他的事情沒讓我對SCJP的東西忘掉太多
或許這張考完,我就該專心準備升學的事情了,不然我真的會忙不過來...
我可不希望因著壓力讓我的身體不適的情況太常發生啊!@@"
以下就來把最後的問題寫出來吧!還煩請各位大大們指導啦XD


import

54.
 


163.
 


173.
Given a class Repetition:

1. package utils;
2.
3. public class Repetition {
4.     public static String twice(String s) { return s + s; }
5. }

and given another class Demo:
1. // insert code here
2.
3. public class Demo {
4.     public static void main(String[] args) {
5.         System.out.println(twice("pizza"));
6.     }
7. }

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();
F. import static utils.Repetition.twice;
G. static import utils.Repetition.twice;


253.
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


260.
Given:

10. package com.sun.scjp;
11. public class Geodetics {
12.     public static final double DIAMETER = 12756.32; // kilometers
13. }
Which two correctly access the DIAMETER member of the Geodetics class? (Choose two.)
A. import com.sun.scjp.Geodetics;
    public class TerraCarta {
        public double halfway()
       { return Geodetics.DIAMETER/2.0; }
B. import static com.sun.scjp.Geodetics;
     public class TerraCarta{
          public double halfway() { return DIAMETER/2.0; } }
C. import static com.sun.scjp.Geodetics.*;
     public class TerraCarta {
         public double halfway() { return DIAMETER/2.0; } }
D. package com.sun.scjp;
     public class TerraCarta {
         public double halfway() { return DIAMETER/2.0; } }


While loop

71.
Given:

35. int x = 10;
36. do {
37.     x--;
38. } while (x < 10);

How many times will line 37 be executed?
A. ten times
B. zero times
C. one to nine times
D. more than ten times


運算==,+=,-=

90.
Given:

11. String[] elements = { "for", "tea", "too" };
12. String first = (elements.length > 0) ? elements[0] : null;

What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. The variable first is set to null.
D. The variable first is set to elements[0].


94.
Given:

11. public class Test {
12.     public static void main(String [] args) {
13.         int x = 5;
14.         boolean b1 = true;
15.         boolean b2 = false;
16.
17.         if ((x == 4) && !b2 )
18.             System.out.print("1 ");
19.             System.out.print("2 ");
20.         if ((b2 = true) && b1 )
21.             System.out.print("3 ");
22.     }
23. }

What is the result?
A. 2
B. 3
C. 1 2
D. 2 3
E. 1 2 3
F. Compilation fails.
G. An exception is thrown at runtime.


177.
Given:

11. public static void test(String str) {
12.     if (str == null | str.length() == 0) {
13.         System.out.println("String is empty");
14.     } else {
15.         System.out.println("String is not empty");
16.     }
17. }

And the invocation:

31. test(null);

What is the result?
A. An exception is thrown at runtime.
B. "String is empty" is printed to output.
C. Compilation fails because of an error in line 12.
D. "String is not empty" is printed to output.


256.
Given:

10. public class MyClass {
11.
12.     public Integer startingI;
13.     public void methodA() {
14.         Integer i = new Integer(25);
15.         startingI = i;
16.         methodB(i);
17.     }
18.     private void methodB(Integer i2) {
19.         i2 = i2.intValue();
20.
21.     }
22. }
If methodA is invoked, which two are true at line 20? (Choose two.)
A. i2 == startingI returns true.
B. i2 == startingI returns false.
C. i2.equals(startingI) returns true.
D. i2.equals(startingI) returns false.


參數呼叫

55.
What is the output of the program shown in the exhibit?
 
A. 300-100-100-100-100
B. 300-300-100-100-100
C. 300-300-300-100-100
D. 300-300-300-300-100


88.
 


172.
What is the outcome of the code?
 
A. Compilation fails.
B. Gobstopper
     Fizzylifting
C. Gobstopper
     Scrumdiddlyumptious
D. Scrumdiddlyumptious
     Fizzylifting
E. Scrumdiddlyumptious


323.
Given:

11. public class ItemTest {
12.     private final int id;
13.     public ItemTest(int id) { this.id = id; }
14.     public void updateId(int newId) { id = newId; }
15.
16.     public static void main(String[] args) {
17.         ItemTest fa = new ItemTest(42);
18.         fa.updateId(69);
19.         System.out.println(fa.id);
20.     }
21. }
What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. The attribute id in the ItemTest object remains unchanged.
D. The attribute id in the ItemTest object is modified to the new value.
E. A new ItemTest object is created with the preferred value in the id attribute.

arrow
arrow
    全站熱搜

    如雲 發表在 痞客邦 留言(2) 人氣()