以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 Java/Eclipse 』 (http://bbs.xml.org.cn/list.asp?boardid=41) ---- SCJP Braindumps 05/15/2002 (http://bbs.xml.org.cn/dispbbs.asp?boardid=41&rootid=&id=31702) |
-- 作者:hongjunli -- 发布时间:5/3/2006 1:48:00 PM -- 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) 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 public static void main(String args[]){ try{return;} finally{ System.out.println("Finally");} } } what is the result? A. print out nothing B. print out "Finally" C. compile error /b 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 "" B. baz has value of null C. baz has value of "Red" D. baz has value of "Blue" E. baz has value of "Green" F. the code does not compile G. the program throw an exception /g /ArrayIndexOutOfBoundsException 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 static void main(String[] args){ StringBuffer a = new StringBuffer("A"); StringBuffer b = new StringBuffer("B"); operate(a,b); System.out.println(a + "," + b); } static void operate(StringBuffer x,StringBuffer y){ y.append(x); y = x; } // end operate } d. "AB,B" e. "AB,AB" f, "A,AB" F private int x; private int y; x that = new x(); (new Thread(that)).start(); (new Thread(that)).start(); } public synchronized void run(){ for( ; ; ){ x++; y++; System.out.Println("x=" + x + ", y=" +y); } } 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 "x=2, y=1") d. The program prints pairs of values for x and y that are always the same on the same line (for example "x=1, y=1") in addition, each value appears twice (for example "x=1, y=1" followed by "x=1, y=1") e. The program prints pairs of values for x and y that are always the same on the same line (for example "x=1, y=1") in addition, each value appears only once (for example "x=1, y=1", followed by "x=2, y=2) 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. } 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) 2. abstract float getFloat(); 3. } 4. public class AbstractTest extends AbstractIt{ 5. private float f1 = 1.0f; 6. private float getFloat(){return f1} 7. } b. An error at line 6 c. An error at line 4 d. An error at line 2 b public static void main(String[] args){ try{ methodA(); }catch(IOException io){ System.out.println("caught IOException"); }catch(Exception e){ System.out.println("caught Exception"); } } public void methodA(){ throw new IOException(); } } b. Output is "caught Exception" c. Output is "caught IOException" d. The program execute nomally whihout print a message a non-static method methodA() cannot be refereced from a static context. public static void main(String[] args)[ try{ return;} finally{ System.out.println("Finally");} } } b. Print "Finally" c. Not compiled and will Exception thrown d. Not compile because catch block missing b 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. } E. t.notify(); F. a.notify(); G. t.interrupt(); C 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. } 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 C B. public boolean mouseDragged(MouseEvent) C. public void mouseDragged(MouseMotionEvent) D. public boolean mouseDragged(MouseMotionEvent) E. public boolean mouseDragged(MouseMotionEvent) A 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. b)AnAdapter1 a = new AnAdapter1(); c)AnAdapter0 a = new AnAdapter0(5); d)AnAdapter1 a = new AnAdapter1(5); e)AnInterface a = new AnInterface(5); a and d are correct. B, c and e are wrong. 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 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 ) 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.} 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 B is correct. b)16>;>;2 c)16>;>;>;2 d)16/2 e)16*4 b and c are correct. final StringBuffer s1=new StringBuffer(); final StringBuffer s2=new StringBuffer(); //Anonymous class public void run(){ synchronized(s1){ s1.append("A"); s2.append(?B?; System.out.println(s1); System.out.println(s2); } // end synch..(s2) } // end synch..(s1) } // end run }.start(); // end anonymous class //Anonymous class public void run(){ s2.append("C"); s1.append("D"); 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 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. a and b are the correct answer int j=i++; if( (i>;++j) && (i++==j) ) i += j; i = 2 is the correct answer. 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 I choose d and e a. char c = "a"; b. char c = '\''; c. char c = ?caf?? d. char c = '\ucafe'; e. char c = 'u10100'; f. char c = (char)true; b, d ( ) int k=4; } b. private c. volatile d. protected e. static f. public g. transient h. final I choose e,f and h which one i will accept it? b. long c. duoble d. float A The accepted values for I are: byte, int, short, char c. public Component getSource() d. public component getTarget() b if(i>;j) continue; j--; }while(++i<6); b.i=5 and j=5 c.i=6 and j=4 d.i=5 and j=6 e.i=6 and j=6 correct answer is ( a ): i = 6 and j = 5 s.substring(2,4); s.concat("xxxx"); s+="ball" baseball 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 I am not sure if < b >; is correct or not. byte c = 126; byte a = b + c; b. compile error c. exception at 1 d. exception at 2 b is correct. compile error: possible loss of precision. To solve this problem, cast it byte a = (byte)(b + c); import java.awt.*; public static void main(String [] args) { new Test(); } Test () { add( new Label(?Hello? ); add( new TextField(?World? ); add( new Button(?Ok? ); pack(); show(); } } 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 C boolean [] b = new boolean[10]; if(b[0]) foo = ?green? System.out.println(?foo: ?+ foo); Foo: blue s.subString(0,4); s.concat(?world); System.out.println(?s: ?+ s); S: hello Strings are immutable. public class Test2 extends Test {??..} Compile error because private not allowed to declare classes. protected class Test {???} public class Test2 extends Test {??..} Compile error because protected not allowed to declare classes. the given double value? 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) int i=1; int j=10; do{ if(i>;j) continue; j - -; } while(++i<6); System.out.println("i= "+i+" j= "+j); } What will be the output? b) i=5 , j=6 c) i=5 , j=5 d) i=4 , j=6 e) i=6 , j=5 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) A String foo = "blue"; boolean [] b = new boolean[10]; if(b[0]) { foo="yellow.";} System.out.println(foo); Ans-blue 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)); 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); 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? ; tStream())); tStream()),"8859-1"); |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
60.547ms |