新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     >>计算机科学论坛<<     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Java, J2SE, J2ME, J2EE, 以及Eclipse, NetBeans, JBuilder等Java开发环境,还有JSP, JavaServlet, JavaBean, EJB以及struts, hibernate, spring, webwork2, Java 3D, JOGL等相关技术。
    [返回] 计算机科学论坛计算机技术与应用『 Java/Eclipse 』 → SCJP Braindumps     05/15/2002 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 4025 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: SCJP Braindumps     05/15/2002 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     hongjunli 帅哥哟,离线,有人找我吗?魔羯座1978-1-20
      
      
      威望:5
      头衔:为振兴论坛而努力!
      等级:研二(中了一篇WWWC Poster)(版主)
      文章:808
      积分:7964
      门派:IEEE.ORG.CN
      注册:2006/3/9

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给hongjunli发送一个短消息 把hongjunli加入好友 查看hongjunli的个人资料 搜索hongjunli在『 Java/Eclipse 』的所有贴子 引用回复这个贴子 回复这个贴子 查看hongjunli的博客楼主
    发贴心情 SCJP Braindumps     05/15/2002

    HI guy, This dump will definetely enable u to pass sun certified java progamer exam. I passed with 88% marks I could remember only these question in my exam. and If you know ur concepts then you are sure to pass. Download my dump and if you can take the exam soon then I am sure u will pass cause these question were in my exam. Dont waste your time

    searching for java dumps just read this but dont memorise the answer just know the concept and this dump will definitely see u thru.

    Good luck to all.


    2. 1) class Super{

    2) public float getNum(){return 3.0f;}

    3) }

    4)

    5) public class Sub extends Super{

    6)

    7) }

    which method, placed at line 6, will cause a compiler error?

    A. public float getNum(){return 4.0f;}

    B. public void getNum(){}

    C. public void getNum(double d){}

    D. public double getNum(float d){return 4.0d;}

    /b


    4. public class Foo{

    public static void main(String args[]){

    try{return;}

    finally{ System.out.println(&quot;Finally&quot;);}

    }

    }

    what is the result?

    A. print out nothing

    B. print out &quot;Finally&quot;

    C. compile error

    /b


    12. public class Test{

    public static void main(String[] args){

    String foo=args[1];

    Sring bar=args[2];

    String baz=args[3];

    }

    }

    java Test Red Green Blue

    what is the value of baz?

    A. baz has value of &quot;&quot;

    B. baz has value of null

    C. baz has value of &quot;Red&quot;

    D. baz has value of &quot;Blue&quot;

    E. baz has value of &quot;Green&quot;

    F. the code does not compile

    G. the program throw an exception

    /g

    /ArrayIndexOutOfBoundsException


    27. public class SychTest{

    private int x;

    private int y;

    public void setX(int i){ x=i;}

    public void setY(int i){y=i;}

    public Synchronized void setXY(int i){

    setX(i);

    setY(i);

    }

    public Synchronized boolean check(){

    return x!=y;

    }

    }

    Under which conditions will check() return true when called from a different class?

    A.check() can never return true.

    B.check() can return true when setXY is callled by multiple threads.

    C.check() can return true when multiple threads call setX and setY separately.

    D.check() can only return true if SychTest is changed allow x and y to be set separately.

    /c


    public class Foo{

    public static void main(String[] args){

    StringBuffer a = new StringBuffer(&quot;A&quot;);

    StringBuffer b = new StringBuffer(&quot;B&quot;);

    operate(a,b);

    System.out.println(a + &quot;,&quot; + b);

    }

    static void operate(StringBuffer x,StringBuffer y){

    y.append(x);

    y = x;

    } // end operate

    }


    What print?


    a. &quot;A,B&quot; b. &quot;A,A&quot; c. &quot;B,B&quot;

    d. &quot;AB,B&quot; e. &quot;AB,AB&quot; f, &quot;A,AB&quot;


    Answer:

    F


    public class x implements Runnable{

    private int x;

    private int y;


    public static void main(String args[] ){

    x that = new x();

    (new Thread(that)).start();

    (new Thread(that)).start();

    }

    public synchronized void run(){

    for( ; ; ){

    x++;

    y++;

    System.out.Println(&quot;x=&quot; + x + &quot;, y=&quot; +y);

    }

    }


    a. An error at line 11

    b. An error at line 7, 8

    c. The program prints pairs of values for x and y that might not always be the same on the same line (for example &quot;x=2, y=1&quot;)

    d. The program prints pairs of values for x and y that are always the same on the same line (for example &quot;x=1, y=1&quot;) in addition, each value appears twice (for example &quot;x=1, y=1&quot; followed by &quot;x=1, y=1&quot;)

    e. The program prints pairs of values for x and y that are always the same on the same line (for example &quot;x=1, y=1&quot;) in addition, each value appears only once (for example &quot;x=1, y=1&quot;, followed by &quot;x=2, y=2)


    1. public class x{

    2. public object m(){

    3. Object o=new Float(2.14F);

    4. Object [] oa=new Object[1];

    5. oa[0]=o;

    6. o=null;

    7. return o;

    8. } // end m() method.

    9. }


    When is the Float object creation in line 3 eligible for garbage collection ?


    a. just after line 5

    b. just after line 6

    c. just after line 7 (that is , as the method returns)

    d. just after line 8 (that is, as the method ends)


    1. abstract class AbstractIt{

    2. abstract float getFloat();

    3. }

    4. public class AbstractTest extends AbstractIt{

    5. private float f1 = 1.0f;

    6. private float getFloat(){return f1}

    7. }


    what result?


    a. compile success

    b. An error at line 6

    c. An error at line 4

    d. An error at line 2


    Answer:

    b


    2. import java.io.IOException;


    public class ExceptionTest{

    public static void main(String[] args){

    try{

    methodA();

    }catch(IOException io){

    System.out.println(&quot;caught IOException&quot;);

    }catch(Exception e){

    System.out.println(&quot;caught Exception&quot;);

    }

    }

    public void methodA(){

    throw new IOException();

    }

    }


    what result?


    a. The code will not compile

    b. Output is &quot;caught Exception&quot;

    c. Output is &quot;caught IOException&quot;

    d. The program execute nomally whihout print a message


    Answer:

    a

    non-static method methodA() cannot be refereced from a static context.


    3. public class Foo{

    public static void main(String[] args)[

    try{ return;}

    finally{ System.out.println(&quot;Finally&quot;);}

    }

    }


    what result?


    a. Print nothing

    b. Print &quot;Finally&quot;

    c. Not compiled and will Exception thrown

    d. Not compile because catch block missing


    Answer:

    b


    4. 1. class A implements Runnable {

    2. int I;

    3. public void run () {

    4. try {

    5. Thread.sleep(5000);

    6. i=10;

    7. }catch(InterruptedException e) {}

    8. }

    9. }

    10.

    11. public class Test {

    12. public static void main (String args[]) {

    13. try {

    14. A a = new A();

    15. Thread t = new Thread(a);

    16. t.start();

    17.

    18. int j= a.i;

    19.

    20. }catch (Exception e) {}

    21. }

    22. }


    Which statement at line 17 will ensure that j=10 at line 19


    A. a.wait(); B. t.wait(); C. t.join(); D. t.yield();

    E. t.notify(); F. a.notify(); G. t.interrupt();


    Answer:

    C


    5. 1. public class SyncTest {

    2. private int x;

    3. private int y;

    4. private synchronized void set X (int i){ x=i; }

    5. private synchronized void set Y (int i){ y=i; }

    6. public void setXY (int i) {set X(i); set Y(i); }

    7. public synchronized boolean check() {return X != Y; }

    8. }


    Under which conditions will check() return when called from a different class. Choose one


    A. check() can never return true

    B. check() can return true when set XY is called by multiple threads

    C. check() can true when multiple threads call set X and set Y separately

    D. check() can only return true if synchTest is changed to allow x and y to be set separately


    Answer:

    C


    6. Which is a method of the MouseMotionListener interface


    A. public void mouseDragged(MouseEvent)

    B. public boolean mouseDragged(MouseEvent)

    C. public void mouseDragged(MouseMotionEvent)

    D. public boolean mouseDragged(MouseMotionEvent)

    E. public boolean mouseDragged(MouseMotionEvent)


    Answer:

    A


    7. AnInterface is an interface.

    AnAdapter0 is an non-Abstract, not-final with zero argument construter

    AnAdapter1 is an non-Abstract, not-final without zero argument construter, but with a constructor to take one argument.


    Which will create Anonymous class (choose two)


    a)AnAdapter0 a = new AnAdapter0();

    b)AnAdapter1 a = new AnAdapter1();

    c)AnAdapter0 a = new AnAdapter0(5);

    d)AnAdapter1 a = new AnAdapter1(5);

    e)AnInterface a = new AnInterface(5);


    Ans:

    a and d are correct. B, c and e are wrong.


    8. What is true about java.util.Arraylist (choose one)


    a)The elements in the collection are ordered

    b)The collection is guaranteed to be immutable.

    c)The elements in the collection are guaranteed to be unique.

    d)The elements in the collection are accessed using a unique key

    e)The elements in the collection are guaranteed to be synchronized


    Answer:

    A is correct.

    ArrayList implemnets all optional List operation.

    b is wrong because lists typically allow duplicate elements. C is wrong this is Set facility. D is wrong because this is Map facility.

    E is wrong, Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally ( refer documents )


    9. 1.class A{

    2. public int getNumber(int a){

    3. return a +1;

    4. }

    5.}

    6.class B extends A{

    7. public int getNumber(int a){

    8. return a + 2;

    9. }

    10. public static void main(String args[]){

    11. B b = new B();

    12. System.out.println(b.getNumber(0));

    13. }

    14.}


    a)compilation succeed and 1 is printed

    b)compilation succeed and 2 is printed

    c)An error at line 8 cause compilation fail

    d)An error at line 12 cause compilation fail


    Answer

    B is correct.


    10. Which two are equivelant


    a)16/2^2

    b)16>;>;2

    c)16>;>;>;2

    d)16/2

    e)16*4


    Answer:

    b and c are correct.


    11. public class TestAnonymous {


    public static void main(String []args){

    final StringBuffer s1=new StringBuffer();

    final StringBuffer s2=new StringBuffer();


    new Thread(){

    //Anonymous class

    public void run(){

    synchronized(s1){

    s1.append(&quot;A&quot;);


    synchronized(s2){

    s2.append(?B?;

    System.out.println(s1);

    System.out.println(s2);

    } // end synch..(s2)

    } // end synch..(s1)

    } // end run

    }.start(); // end anonymous class


    new Thread(){

    //Anonymous class

    public void run(){


    synchronized(s2){

    s2.append(&quot;C&quot;);


    synchronized(s1){

    s1.append(&quot;D&quot;);

    System.out.println(s2);

    System.out.println(s1);

    } // end synch..(s1)

    } // end synch..(s2)

    } // end run

    }.start(); // end anonymous class

    } // end main

    } // end Test class


    What is the result? ( choose two )


    a)print ABBCAD

    b)print CDDACB

    c)print ADCBADBC

    d)The output is a not-deterministic point because of a possible deadlock condition

    e)The output is dependent on the threading model of the system the program is running on.


    Answer:

    a and b are the correct answer


    int i=1;

    int j=i++;

    if( (i>;++j) &amp;&amp; (i++==j) )

    i += j;


    What is the value of i after this code is finished?


    Answer:

    i = 2 is the correct answer.


    which two CANNOT directly cause a thread to stop executing?


    a. exiting from a synchronized block

    b. calling the wait method

    c. calling the notify method on an object

    d. calling a read method on an InputStream object

    e. calling the setPriority method on a Thread object


    Answer:

    I choose d and e


    which is correct for declaring a character

    a. char c = &quot;a&quot;;

    b. char c = '\'';

    c. char c = ?caf??

    d. char c = '\ucafe';

    e. char c = 'u10100';

    f. char c = (char)true;


    Answer:

    b, d


    public interface Foo {

    ( ) int k=4;

    }


    which one the right to describe int k = 4 in interface foo? (choose three)


    a. abstract

    b. private

    c. volatile

    d. protected

    e. static

    f. public

    g. transient

    h. final


    Answer:

    I choose e,f and h


    switch(i) {}

    which one i will accept it?


    a. byte

    b. long

    c. duoble

    d. float


    Answer:

    A

    The accepted values for I are: byte, int, short, char


    Given an Action Event which method allows you to identify the affected Component?


    a. public Component getClass() b. pubilc Object getSource()

    c. public Component getSource() d. public component getTarget()


    Answer:

    b


    int i=1; int j=10;


    do{

    if(i>;j) continue;

    j--;

    }while(++i<6);


    After execution, what are the value for i and j?


    a. i=6 and j=5

    b.i=5 and j=5

    c.i=6 and j=4

    d.i=5 and j=6

    e.i=6 and j=6


    Answer:

    correct answer is ( a ): i = 6 and j = 5


    String s=&quot;base&quot;;

    s.substring(2,4);

    s.concat(&quot;xxxx&quot;);

    s+=&quot;ball&quot;


    What is the result of s? (note: there was a TextField to write your answer into it )


    Answer:

    baseball


    which statement is true? ( choose one )


    a. the Error class is a RuntimeException

    b. No exceptions are subclass of Error

    c. Any statement that may throw an Error must be enclosed in a try block

    d. Any statement that may throw an Exception must be enclosed in a try block

    e. Any statement that may throw a RuntimeException must be enclosed in a try block


    Answer:

    I am not sure if < b >; is correct or not.


    byte b = 127;

    byte c = 126;

    byte a = b + c;


    what is the result?


    a. a will equal to 253

    b. compile error

    c. exception at 1

    d. exception at 2


    Answer:

    b is correct. compile error: possible loss of precision. To solve this problem, cast it

    byte a = (byte)(b + c);


    28.

    import java.awt.*;


    public class Test extends Frame {

    public static void main(String [] args) {

    new Test();

    }

    Test () {

    add( new Label(?Hello? );

    add( new TextField(?World? );

    add( new Button(?Ok? );

    pack();

    show();

    }

    }


    what is the result?


    a. compile error

    b. three components will appear, Label at North, TextField at South and Button at Center.

    c. only one Button at the Center

    d. Frame will appear, but nothing there

    e. exception will be thrown


    Answer:

    C


    String foo = ?blue?

    boolean [] b = new boolean[10];

    if(b[0])

    foo = ?green?

    System.out.println(?foo: ?+ foo);


    What will foo print?


    Answer:

    Foo: blue


    String s = ?hello?

    s.subString(0,4);

    s.concat(?world);

    System.out.println(?s: ?+ s);


    What is the result?


    Answer:

    S: hello

    Strings are immutable.


    private class Test {???}

    public class Test2 extends Test {??..}


    what is the result? (there are options to choose)


    Answer:

    Compile error because private not allowed to declare classes.


    32.

    protected class Test {???}

    public class Test2 extends Test {??..}


    what is the result? (there are options to choose)


    Answer:

    Compile error because protected not allowed to declare classes.


    78. Which will return an int value very nearer to and not greater than

    the given double value?


    a) int a=(int)Math.max(double)

    b) int a=(int)Math.min(double)

    c) int a=(int)Math.ceil(double)

    d) int a=(int)Math.floor(double)

    e) int a=(int)Math.round(double)


    Ans d


    83. public static void main(String args[]) {

    int i=1;

    int j=10;

    do{

    if(i>;j)

    continue;

    j - -;

    } while(++i<6);

    System.out.println(&quot;i= &quot;+i+&quot; j= &quot;+j);

    }

    What will be the output?


    a) i=4 , j=5

    b) i=5 , j=6

    c) i=5 , j=5

    d) i=4 , j=6

    e) i=6 , j=5


    Ans e


    Q#14 method of mousemotionlistener interface

    A. public void mouseDragged(MouseEvent)

    B. public boolean mouseDragged(MouseEvent)

    C. public void mouseDragged(MouseMotionEvent)

    D. public boolean mouseDragged(MouseMotionEvent)

    E. public boolean mouseDragged(MouseMotionEvent)


    Answer:

    A


    Q#19 output of the following program

    String foo = &quot;blue&quot;;

    boolean [] b = new boolean[10];

    if(b[0]) {

    foo=&quot;yellow.&quot;;}

    System.out.println(foo);

    Ans-blue


    246. Which of the following two declarations used to read a file

    called ?Test.txt?

    a) RandomAcceesFile raf=new RandomAcceesFile(?Test.txt?;

    b) InputStream is = new FileInputStream(?Test.txt?;

    c) InputStream is = new

    DataInputStream(FileInputStream(?Test.txt?true));

    d) FileInputStream fis = new FileInputStream(new File(?Test.txt?);

    e) FileoutputStream fos = new FileoutputStream(new File(?Test.txt?);

    f) OutputStream os = new FileoutputStream(new File(?Test.txt?false));


    Ans BD


    252. How to append to file ?Test.txt? (Select two)

    a) FileOutputStream fis = new FileOutputStream ( ?Test.txt? true);

    b) OutputStream os = new FileOutputStream ( ?Test.txt? ?append?;

    c) FileOutputStream fis = new FileOutputStream ( ?Test.txt? ?true?;

    d) FileOutputStream fis = new FileOutputStream (new File( ?Test.txt?);

    e) OutputStream os = new OutputStream (new File( ?Test.txt?, true);


    Ans AD


    27.A socket object has been created and connected to a standard intern

    et sevice on a remote network server.Which construction give the most

    suitable means for reading ASCII data one line at a time from the sock

    et?


    A.InputStream in=s.getInputStream();


    B.DataInputStream in=new DataInputstream(s.getInputStream());


    C.ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream())

    ;


    D.BufferedReader in=new BufferedReader(new InputStreamReader(s.getInpu

    tStream()));


    E.BufferedReader in=new BufferedReader(new InputStreamReader(s.getInpu

    tStream()),&quot;8859-1&quot;);


    2. Which gets the name of the parent directory of file &quot;file.txt&quot;?


    a. String name = File.getParentName(&quot;file.txt&quot;)


    b. String name = (new File (&quot;file.txt&quot;).getParent());


    c. String name = (new File (&quot;file.txt&quot;).getParentName());


    d. String name = (new File (&quot;file.txt&quot;).getParentFile());


    e. Directory dir = (new File (&quot;file.txt&quot;).getParentDir());


    String name = dir.getName();


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/5/3 13:48:00
     
     GoogleAdSense魔羯座1978-1-20
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Java/Eclipse 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/16 17:20:57

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    93.750ms