多选题Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b: 

题目
多选题
Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };
A

Code fragment a.

B

Code fragment b.

C

Code fragment c.

D

Code fragment d.

E

Code fragment e.


相似考题
更多“Which code fragments will succeed in initializing a two-dime”相关问题
  • 第1题:

    Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix > 0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }  

    • A、Code fragment a.
    • B、Code fragment b.
    • C、Code fragment c.
    • D、Code fragment d.
    • E、Code fragment e.

    正确答案:A

  • 第2题:

    Which two code fragments will execute the method doStuff() in a separate thread?()

    • A、new Thread() {public void run() { doStuff(); }};
    • B、new Thread() {public void start() { doStuff(); }};
    • C、new Thread() {public void start() { doStuff(); }}.run();
    • D、new Thread() {public void run() { doStuff(); }}.start();
    • E、new Thread(new Runnable() {public void run() { doStuff(); }}).start();

    正确答案:D,E

  • 第3题:

    多选题
    10.publicclassBar{ 11.staticvoidfoo(int...x){ 12.//insertcodehere 13.} 14.} Which two code fragments,inserted independently at line1 2,will allow the class to compile()
    A

    foreach(x)System.out.println(z);

    B

    for(intz:x)System.out.println(z);

    C

    while(x.hasNext())System.out.println(x.next());

    D

    for(inti=0;i


    正确答案: B,C
    解析: 暂无解析

  • 第4题:

    单选题
    Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?()
    A

    Vector filelist = ((Directory) file).getList();

    B

    String[] filelist = file.directory();

    C

    Enumeration filelist = file.contents();

    D

    String[] filelist = file.list();

    E

    Vector filelist = (new Directory(file)).files();


    正确答案: C
    解析: 暂无解析

  • 第5题:

    多选题
    Which two code fragments correctly create and initialize a static array of int elements?()
    A

    A

    B

    B

    C

    C

    D

    D


    正确答案: A,C
    解析: 暂无解析

  • 第6题:

    多选题
    Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?()   import java.awt.*;   public class Q1e65 {   public static void main(String args[]) {   Window win = new Frame();   Button but = new Button("button");   // insert code fragment here  win.setSize(200, 200);   win.setVisible(true);   }   }
    A

    win.setLayout(new BorderLayout()); win.add(but);

    B

    win.setLayout(new GridLayout(1, 1)); win.add(but);

    C

    win.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);

    D

    win.add(but);

    E

    win.setLayout(new FlowLayout()); win.add(but);


    正确答案: B,D
    解析: 暂无解析

  • 第7题:

    多选题
    The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?()
    A

    char ch = 65;

    B

    char ch = ’¥65’;

    C

    char ch = ’¥0041’;

    D

    char ch = ’A’;

    E

    char ch = A;


    正确答案: A,D
    解析: 暂无解析

  • 第8题:

    多选题
    Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()
    A

    String s = c.readLine();

    B

    char[] c = c.readLine();

    C

    String s = c.readConsole();

    D

    char[] c = c.readConsole();

    E

    String s = c.readLine(%s, name );


    正确答案: E,D
    解析: 暂无解析

  • 第9题:

    多选题
    Which two statements are true about MLP interleaving? ()
    A

    It fragments and encapsulates all packets in a fragmentation header.

    B

    Packets smaller than the fragmentation size are interleaved between the fragments of thelarger packets.

    C

    Packets larger than the fragmentation size are always fragmented, and cannot be interleaved,even if the traffic is voice traffic.

    D

    It fragments and encapsulates packets that are longer than a configured size, but does not encapsulate smaller packets inside a fragmentation header.


    正确答案: B,D
    解析: 暂无解析

  • 第10题:

    多选题
    Which two code fragments are most likely to cause a StackOverflowError?()
    A

    A

    B

    B

    C

    C

    D

    D

    E

    E

    F

    F


    正确答案: A,D
    解析: 暂无解析

  • 第11题:

    Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };  

    • A、Code fragment a.
    • B、Code fragment b.
    • C、Code fragment c.
    • D、Code fragment d.
    • E、Code fragment e.

    正确答案:B,E

  • 第12题:

    单选题
    Which of the following tools should be used to report in-depth information about file fragments?()
    A

     defragfs

    B

     istat

    C

     filemon

    D

     fileplace


    正确答案: D
    解析: 暂无解析

  • 第13题:

    单选题
    Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix > 0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }
    A

    Code fragment a.

    B

    Code fragment b.

    C

    Code fragment c.

    D

    Code fragment d.

    E

    Code fragment e.


    正确答案: C
    解析: 暂无解析

  • 第14题:

    多选题
    Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()
    A

    String s = c.readLine();

    B

    char[ ] c = c.readLine();

    C

    String s = c.readConsole();

    D

    char[ ] c = c.readConsole();

    E

    String s = c.readLine(%s, name );

    F

    char[ ] c = c.readLine(%s, name );


    正确答案: E,F
    解析: 暂无解析

  • 第15题:

    多选题
    Which two code fragments correctly create and initialize a static array of int elements?()
    A

    static final int[] a = { 100,200 };

    B

    static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }

    C

    static final int[] a = new int[2]{ 100,200 };

    D

    static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }


    正确答案: A,D
    解析: 暂无解析

  • 第16题:

    多选题
    Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };
    A

    Code fragment a.

    B

    Code fragment b.

    C

    Code fragment c.

    D

    Code fragment d.

    E

    Code fragment e.


    正确答案: D,B
    解析: 暂无解析

  • 第17题:

    多选题
    package sun.scjp;  public enum Color { RED, GREEN, BLUE }  package sun.beta;  // insert code here  public class Beta {  Color g = GREEN;  public static void main( String[] argv)  { System.out.println( GREEN); }  }  The class Beta and the enum Color are in different packages.  Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()
    A

    import sun.scjp.Color.*;

    B

    import static sun.scjp.Color.*;

    C

    import sun.scjp.Color; import static sun.scjp.Color.*;

    D

    import sun.scjp.*; import static sun.scjp.Color.*;

    E

    import sun.scjp.Color; import static sun.scjp.Color.GREEN;


    正确答案: A,D
    解析: 暂无解析

  • 第18题:

    多选题
    Which two code fragments will execute the method doStuff() in a separate thread?()
    A

    new Thread() { public void run() { doStuff(); } }

    B

    new Thread() { public void start() { doStuff(); } }

    C

    new Thread() { public void start() { doStuff(); } } .run();

    D

    new Thread() { public void run() { doStuff(); } } .start();

    E

    new Thread(new Runnable() { public void run() { doStuff(); } } ).run();

    F

    new Thread(new Runnable() { public void run() { doStuff(); } }).start();


    正确答案: D,F
    解析: 暂无解析

  • 第19题:

    多选题
    10. public class Bar {  11.static void foo(int...x) {  12. // insert code here  13. }  14. }  Which two code fragments, inserted independently at line 12, will allow the class to compile?()
    A

    foreach(x) System.out.println(z);

    B

    for(int z : x) System.out.println(z);

    C

    while( x.hasNext()) System.out.println( x.next());

    D

    for( int i=0; i< x.length; i++ ) System.out.println(x[i]);


    正确答案: B,D
    解析: 暂无解析

  • 第20题:

    多选题
    Given: Which four code fragments, inserted independently at line 7, will compile?()
    A

    public void m1() { }

    B

    protected void m1() { }

    C

    private void m1() { }

    D

    void m2() { }

    E

    public void m2() { }

    F

    protected void m2() { }


    正确答案: F,A
    解析: 暂无解析