新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   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综合测试题 查看新帖用户列表

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

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

    1. Which of the following are valid definitions of an application's main( ) method?
    A. public static void main();
    B. public static void main( String args );
    C. public static void main( String args[] );
    D. public static void main( Graphics g );
    E. public static boolean main( String args[] );

    2. If MyProg.java were compiled as an application and then run from the command line as:
    java MyProg I like tests
    what would be the value of args[ 1 ] inside the main( ) method?
    A. MyProg
    B. "I"
    C. "like"
    D. 3
    E. 4
    F. null until a value is assigned

    3. Which of the following are Java keywords?
    A. array
    B. boolean
    C. Integer
    D. protect
    E. super

    4. After the declaration:
    char[] c = new char[100];
    what is the value of c[50]?
    A. 50
    B. 49
    C. '\u0000'
    D. '\u0020'
    E." "
    F. cannot be determined
    G. always null until a value is assigned

    5. After the declaration:
    int x;
    the range of x is:
    A. -231 to 231-1
    B. -216 to 216 - 1
    C. -232 to 232
    D. -216 to 216
    E. cannot be determined; it depends on the machine

    6. Which identifiers are valid?
    A. _xpoints
    B. r2d2
    C. bBb$
    D. set-flow
    E. thisisCrazy
     
    7. Which of the following describe the sequence of method calls that result in a component being redrawn?
    A. invoke paint() directly
    B. invoke update which calls paint()
    C. invoke repaint() which invokes update(), which in turn invokes paint()
    D. setflow

    8. Which of the following statements assigns "Hello Java" to the String variable s?
    A. String s = "Hello Java";
    B. String s[] = "Hello Java";
    C. new String s = "Hello Java";
    D. String s = new String("Hello Java");

    9. An integer, x has a binary value (using 1 byte) of 10011100. What is the binary value of z after these statements:
    int y = 1 << 7;
    int z = x & y;
    A. 1000 0001
    B. 1000 0000
    C. 0000 0001
    D. 1001 1101
    E. 1001 1100

    10. Which statements are accurate:
    A. >;>; performs signed shift while >;>;>; performs an unsigned shift.
    B. >;>;>; performs a signed shift while >;>; performs an unsigned shift
    C. << performs a signed shift while <<< performs an insigned shift.
    D. <<< performs a signed shift while << performs an unsigned shift.

    11. The statement ...
    String s = "Hello" + "Java";
    yields the same value for s as ...
    String s = "Hello";
    String s2= "Java";
    s.concat( s2 );
    A. True
    B. False

    --------------------------------------------------------------------------------
    猫小 回复于:2003-10-30 08:17:02

    12. If you compile and execute an application with the following code in its main() method:
    String s = new String( "Computer" );
    if( s == "Computer" )
    System.out.println( "Equal A" );
    if( s.equals( "Computer" ) )
    System.out.println( "Equal B" );
    A. It will not compile because the String class does not support the = = operator.
    B. It will compile and run, but nothing is printed.
    C. "Equal A" is the only thing that is printed.
    D. "Equal B" is the only thing that is printed.
    E.Both "Equal A" and "Equal B" are printed.

    13. Consider the two statements:

    1. boolean passingScore = false && grade == 70;
    2. boolean passingScore = false & grade == 70;
    The expression
    grade == 70
    is evaluated:
    A. in both 1 and 2
    B. in neither 1 nor 2
    C. in 1 but not 2
    D. in 2 but not 1
    E.invalid because false should be FALSE

    14. Given the variable declarations below:

    byte myByte;
    int myInt;
    long myLong;
    char myChar;
    float myFloat;
    double myDouble;
    Which one of the following assignments would need an explicit cast?
    A. myInt = myByte;
    B. myInt = myLong;
    C. myByte = 3;
    D. myInt = myChar;
    E. myFloat = myDouble;
    F. myFloat = 3;
    G. myDouble = 3.0;

    15. Consider this class example:

    class MyPoint
    { void myMethod()
    { int x, y;
    x = 5; y = 3;
    System.out.print( " ( " + x + ", " + y + " ) " );
    switchCoords( x, y );
    System.out.print( " ( " + x + ", " + y + " ) " );
    }
    void switchCoords( int x, int y )
    { int temp;
    temp = x;
    x = y;
    y = temp;
    System.out.print( " ( " + x + ", " + y + " ) " );
    }
    }
    What is printed to standard output if myMethod() is executed?
    A. (5, 3) (5, 3) (5, 3)
    B. (5, 3) (3, 5) (3, 5)
    C. (5, 3) (3, 5) (5, 3)

    16. To declare an array of 31 floating point numbers representing snowfall for each day of March in Gnome, Alaska, which declarations would be valid?
    A. double snow[] = new double[31];
    B. double snow[31] = new array[31];
    C. double snow[31] = new array;
    D. double[] snow = new double[31];

    17. If arr[] contains only positive integer values, what does this function do?

    public int guessWhat( int arr[] )
    { int x= 0;
    for( int i = 0; i < arr.length; i++ )
    x = x < arr ? arr : x;
    return x;
    }
    A. Returns the index of the highest element in the array
    B. Returns true/false if there are any elements that repeat in the array
    C. Returns how many even numbers are in the array
    D. Returns the highest element in the array
    E. Returns the number of question marks in the array

    18. Consider the code below:

    arr[0] = new int[4];
    arr[1] = new int[3];
    arr[2] = new int[2];
    arr[3] = new int[1];
    for( int n = 0; n < 4; n++ )
    System.out.println( /* what goes here? */ );

    Which statement below, when inserted as the body of the for loop, would print the number of values in each row?
    A. arr[n].length();
    B. arr.size;
    C. arr.size -1;
    D. arr[n][size];
    E. arr[n].length;

    19.If size = 4, triArray looks like:

     
    int[][] makeArray( int size)
    { int[][] triArray = new int[size] [];
    int val=1;
    for( int i = 0; i < triArray.length; i++ )
    { triArray = new int[i+1];
    for( int j=0; j < triArray.length; j++ )
    { triArray[j] = val++;
    }
    }
    return triArray;
    }
    A.
    1 2 3 4
    5 6 7
    8 9
    10
    B. 1 4 9 16
    C. 1 2 3 4
    D.
    1 2 3 4
    5 6 7 8
    9 10 11 12
    13 14 15 16
    E.
    1
    2 3
    4 5 6
    7 8 9 10

    20. Which of the following are legal declarations of a two-dimensional array of integers?
    A. int[5][5]a = new int[][];
    B. int a = new int[5,5];
    C. int[]a[] = new int[5][5];
    D. int[][]a = new[5]int[5];

    21. Which of the following are correct methods for initializing the array "dayhigh" with 7 values?
    A. int dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
    B.int dayhigh[] = { 24, 23, 24, 25, 25, 23, 21 };
    C. int[] dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
    D. int dayhigh [] = new int[24, 23, 24, 25, 25, 23, 21];
    E. int dayhigh = new[24, 23, 24, 25, 25, 23, 21];

    22. Choose all valid forms of the argument list for the FileOutputStream constructor shown below:
    A. FileOutputStream( FileDescriptor fd )
    B. FileOutputStream( String n, boolean a )
    C. FileOutputStream( boolean a )
    D. FileOutputStream()
    E. FileOutputStream( File f )


    --------------------------------------------------------------------------------
    猫小 回复于:2003-10-30 08:21:02

    23.A "mode" argument such as "r" or "rw" is required in the constructor for the class(es):
    A. public static boolean main( String args[] );
    B. InputStream
    C. RandomAccessFile
    D. File
    E. None of the above

    24. Consider the code below:

    public static void main( String args[] )
    { int a = 5;
    System.out.println( cube( a ) );
    }
    int cube( int theNum )
    {
    return theNum * theNum * theNum;
    }
    What will happen when you attempt to compile and run this code?
    A. It will not compile because cube is already defined in the java.lang.Math class.
    B.It will not compile because cube is not static.
    C.It will compile, but throw an arithmetic exception.
    D.It will run perfectly and print "125" to standard output.

    25. Given the variables defined below:
    int one = 1;
    int two = 2;
    char initial = '2';
    boolean flag = true;

    Which of the following are valid?
    A. if( one ){}
    B.if( one = two ){}
    C. if( one == two ){}
    D.if( flag ){}
    E. switch( one ){}
    F. switch( flag ){}
    G.switch( initial ){} 

    26. If val = 1 in the code below:

     
    switch( val )
    { case 1: System.out.print( "P" );
    case 2:
    case 3: System.out.print( "Q" );
    break;
    case 4: System.out.print( "R" );
    default: System.out.print( "S" );
    }
    Which values would be printed?
    A. P
    B. Q
    C. R
    D. S

    27. Assume that val has been defined as an int for the code below:

     
    if( val >; 4 )
    { System.out.println( "Test A" );
    }
    else if( val >; 9 )
    { System.out.println( "Test B" );
    }
    else System.out.println( "Test C" );
    Which values of val will result in "Test C" being printed:
    A. val < 0
    B. val between 0 and 4
    C. val between 4 and 9
    D. val >; 9
    E. val = 0
    F. no values for val will be satisfactory

    28. Which of the following are valid definitions of an application's main( ) method?
    A. public static void main();
    B. public static void main( String args );
    C. public static void main( String args[] );
    D. public static void main( Graphics g );
    E. public static boolean main( String args[] );

    29. For the code:

    m = 0;
    while( m++ < 2 )
    System.out.println( m );
    Which of the following are printed to standard output?
    A. 0
    B. 1
    C. 2
    D. 3
    E. Nothing and an exception is

    30. Consider the code fragment below:

     
    outer: for( int i = 1; i <3; i++ )
    { inner: for( j = 1; j < 3; j++ )
    { if( j==2 )
    continue outer;
    System.out.println( "i = " +i ", j = " + j );
    }
    }
    Which of the following would be printed to standard output?
    A. i = 1, j = 1
    B. i = 1, j = 2
    C. i = 1, j = 3
    D. i = 2, j = 1
    E. i = 2, j = 2
    F. i = 2, j = 3
    G. i = 3, j = 1
    H. i = 3, j = 2

    31. Consider the code below:

    void myMethod()
    { try
    {
    fragile();
    }
    catch( NullPointerException npex )
    {
    System.out.println( "NullPointerException thrown " );
    }
    catch( Exception ex )
    {
    System.out.println( "Exception thrown " );
    }
    finally
    {
    System.out.println( "Done with exceptions " );
    }
    System.out.println( "myMethod is done" );
    }
    What is printed to standard output if fragile() throws an IllegalArgumentException?
    A. "NullPointerException thrown"
    B. "Exception thrown"
    C. "Done with exceptions"
    D. "myMethod is done"
    E. Nothing is printed

    32. Consider the following code sample:

    class Tree{}
    class Pine extends Tree{}
    class Oak extends Tree{}
    public class Forest
    { public static void main( String[] args )
    { Tree tree = new Pine();

    if( tree instanceof Pine )
    System.out.println( "Pine" );

    if( tree instanceof Tree )
    System.out.println( "Tree" );

    if( tree instanceof Oak )
    System.out.println( "Oak" );

    else System.out.println( "Oops" );
    }
    }

    Select all choices that will be printed:
    A. Pine
    B. Tree
    C. Forest
    D. Oops
    E. (nothing printed)

    33. Consider the classes defined below:

    import java.io.*;
    class Super
    {
    int methodOne( int a, long b ) throws IOException
    { // code that performs some calculations
    }
    float methodTwo( char a, int b )
    { // code that performs other calculations
    }
    }
    public class Sub extends Super
    {

    }
    Which of the following are legal method declarations to add to the class Sub? Assume that each method is the only one being added.
    A. public static void main( String args[] ){}
    B. float methodTwo(){}
    C. long methodOne( int c, long d ){}
    D. int methodOne( int c, long d ) throws ArithmeticException{}
    E. int methodOne( int c, long d ) throws FileNotFoundException{}
     


    --------------------------------------------------------------------------------
    猫小 回复于:2003-10-30 08:28:44

    34. Assume that Sub1 and Sub2 are both subclasses of class Super.

    Given the declarations:

    Super super = new Super();
    Sub1 sub1 = new Sub1();
    Sub2 sub2 = new Sub2();

    Which statement best describes the result of attempting to compile and execute the following statement:

    super = sub1;
    A. Compiles and definitely legal at runtime
    B. Does not compile
    C. Compiles and may be illegal at runtime

    35. For the following code:

    class Super
    { int index = 5;
    public void printVal()
    { System.out.println( "Super" );
    }
    }
    class Sub extends Super
    { int index = 2;
    public void printVal()
    { System.out.println( "Sub" );
    }
    }
    public class Runner
    { public static void main( String argv[] )
    { Super sup = new Sub();
    System.out.print( sup.index + "," );
    sup.printVal();
    }
    }
    What will be printed to standard output?
    A. The code will not compile.
    B. The code compiles and "5, Super" is printed to standard output.
    C. The code compiles and "5, Sub" is printed to standard output.
    D. The code compiles and "2, Super" is printed to standard output.
    E.The code compiles and "2, Sub" is printed to standard output.
    F.The code compiles, but throws an exception.

    36. How many objects are eligible for garbage collection once execution has reached the line labeled Line A?

    String name;
    String newName = "Nick";
    newName = "Jason";
    name = "Frieda";

    String newestName = name;

    name = null;
    //Line A
    A. 0
    B. 1
    C. 2
    D. 3
    E. 4

    37. Which of the following statements about Java's garbage collection are true?
    A. The garbage collector can be invoked explicitly using a Runtime object.
    B. float methodTwo(){}
    C. long methodOne( int c, long d ){}
    D. int methodOne( int c, long d ) throws ArithmeticException{}

    38.A directory can be created using a method from the class(es):
    A. public static boolean main( String args[] );
    B. DataOutput
    C. Directory
    D. FileDescriptor
    E. FileOutputStream

    39. Which methods are required to implement the interface Runnable.
    A. None of these
    B. run()
    C. stop()
    D. update()
    E. resume()

    40. If raf is a RandomAccessFile, what is the result of compiling and executing the following code?

    raf.seek( raf.length() );
    A. The code will not compile.
    B. An IOException will be thrown.
    C. The file pointer will be positioned immediately before the last character of the file.
    D. The file pointer will be positioned immediately after the last character of the file.

    41. For what reasons might a thread stop execution?
    A. A thread with higher priority began execution.
    B. The thread's wait() method was invoked.
    C. long methodOne( int c, long d ){}
    D. The thread's pause() method was invoked.
    E. methodOne( int c, long d ) throws FileNotFoundException{}

    42. Which method below can change a String objects ?
    A. equals( s )
    B. substring( s )
    C. concat( s )
    D. toUpperCase( s )
    E. none of the above will change s

    43. If s1 is declared as:

    String s1 = "phenobarbital";

    What will be the value of s2 after the following line of code:

    String s2 = s1.substring( 3, 5 );
    A. null
    B."eno"
    C. "enoba"
    D. "no"

    44. What method(s) from the java.lang.Math class might method() be if the statement

    method( -4.4 ) == -4;

    is true.
    A. round()
    B. min()
    C. trunc()
    D. abs()
    E. floor()
    F. ceil()


    --------------------------------------------------------------------------------
    猫小 回复于:2003-10-30 08:31:30

    45. Which methods does java.lang.Math include for trigonometric computations?
    A. sin()
    B. cos()
    C. tan()
    D. aSin()
    E. aCos()
    F. aTan()
    G. toDegree()

    46. This piece of code:

    TextArea ta = new TextArea( 10, 3 );

    Produces (select all correct statements):
    A. a TextArea with 10 rows and up to 3 columns
    B.a TextArea with a variable number of columns not less than 10 and 3 rows
    C. a TextArea that may not contain more than 30 characters
    D.a TextArea that can be edited

    47. In the list below, which subclass(es) of Component cannot be directly instantiated:
    A. Panel
    B. Dialog
    C. Container
    D. Frame

    48. Of the five Component methods listed below, only one is also a method of the class MenuItem. Which one?
    A. setVisible( boolean b )
    B. setEnabled( boolean b )
    C. getSize()
    D. setForeground( Color c )
    E. setBackground( Color c )

    49. If a font with variable width is used to construct the string text for a column, the initial size of the column is:
    A. determined by the number of characters in the string, multiplied by the width of a character in this font
    B. determined by the number of characters in the string, multiplied by the average width of a character in this font
    C. exclusively determined by the number of characters in the string
    D. undetermined

    50. Which of the following methods from the java.awt.Graphics class would be used to draw the outline of a rectangle with a single method call?
    A. thisisCrazy
    B. drawRect()
    C. fillPolygon()
    D. drawPolygon()
    E. drawLine()

    51. The Container methods add( Component comp ) and add( String name, Component comp ) will throw an IllegalArgumentException if comp is a:
    A. button
    B. list
    C. window
    D. textarea
    E. container that contains this container

    52. Of the following AWT classes, which one(s) are responsible for implementing the components layout?

    A. LayoutManager
    B. GridBagLayout
    C. ActionListener
    D. WindowAdapter
    E. FlowLayout

    53. A component that should resize vertically but not horizontally should be placed in a:
    A. BorderLayout in the North or South location
    B. FlowLayout as the first component
    C.BorderLayout in the East or West location
    D. BorderLayout in the Center location
    E.GridLayout

    54.Which of the following methods is used to change the contents of the string World to also include the characters Hello?
    A. trim ()
    B. insert ()
    C. append ()
    D. None of these

    55.Which of the following methods is used to change the contents of the string World to also include the characters Hello?
    A. trim ()
    B. insert ()
    C. append ()
    D. None of these 【完毕】


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/5/3 13:54:00
     
     hany30748889 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:1
      积分:63
      门派:XML.ORG.CN
      注册:2006/9/15

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给hany30748889发送一个短消息 把hany30748889加入好友 查看hany30748889的个人资料 搜索hany30748889在『 Java/Eclipse 』的所有贴子 引用回复这个贴子 回复这个贴子 查看hany30748889的博客2
    发贴心情 
    有答案吗?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/7/26 22:47:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Java/Eclipse 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/27 13:31:30

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

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