itgle.com

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

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

A

B

B

C

C

D

D


相似考题
更多“多选题Which two code fragments correctly create and initialize a static array of int elements?()AABBCCDD”相关问题
  • 第1题:

    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 int foo() { /* more code here */ }
    • B、 void foo() { /* more code here */ }
    • C、 public void foo() { /* more code here */ }
    • D、 private void foo() { /* more code here */ }
    • E、 protected void foo() { /* more code here */ }

    正确答案:B,C,E

  • 第2题:

    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 int(){a=new int[3];a[0]=100;a[1]=200;}

    正确答案:A,B

  • 第3题:

    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

  • 第4题:

    Which three form part of correct array declarations?()  

    • A、 public int a []
    • B、 static int [] a
    • C、 public [] int a
    • D、 private int a [3]
    • E、 private int [3] a []
    • F、 public final int [] a

    正确答案:A,B,F

  • 第5题:

    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

  • 第6题:

    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 public void foo() { /* more code here */ }
    • B、 private void foo() { /* more code here */ }
    • C、 protected void foo() { /* more code here */ }
    • D、 int foo() { /* more code here */ }  
    • E、 void foo() { /* more code here */ }

    正确答案:A,C,E

  • 第7题:

    多选题
    Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


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

  • 第8题:

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

    A

    B

    B

    C

    C

    D

    D


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

  • 第9题:

    多选题
    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 int(){a=new int[3];a[0]=100;a[1]=200;}


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

  • 第10题:

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

    int []x = {1,2,3,4,5};for(int y = 0; y < 6; y++)    System.out.println(x[y]);

    B

    static int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }

    C

    for(int y = 10; y < 10; y++)doStuff(y);

    D

    void doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }

    E

    for(int x = 0; x < 1000000000; x++) doStuff(x);

    F

    void counter(int i) { counter(++i); }


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

  • 第11题:

    多选题
    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,C
    解析: 暂无解析

  • 第12题:

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

    A

    B

    B

    C

    C

    D

    D

    E

    E

    F

    F


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

  • 第13题:

    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

  • 第14题:

    Which two create an instance of an array?() 

    • A、 int ia = new int [15];
    • B、 float fa = new float [20];
    • C、 char ca = “Some String”;
    • D、 Object oa = new float[20];
    • E、 Int ia = (4, 5, 6) (1, 2, 3)

    正确答案:A,D

  • 第15题:

    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;

    正确答案:C,E

  • 第16题:

    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

  • 第17题:

    Which two code fragments are most likely to cause a StackOverflowError?()

    • A、int []x = {1,2,3,4,5};for(int y = 0; y < 6; y++)    System.out.println(x[y]);
    • B、static int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }
    • C、for(int y = 10; y < 10; y++)doStuff(y);
    • D、void doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }
    • E、for(int x = 0; x < 1000000000; x++) doStuff(x);
    • F、void counter(int i) { counter(++i); }

    正确答案:D,F

  • 第18题:

    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,B

  • 第19题:

    多选题
    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
    解析: 暂无解析

  • 第20题:

    多选题
    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,B
    解析: 暂无解析

  • 第21题:

    多选题
    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
    解析: 暂无解析

  • 第22题:

    多选题
    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


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

  • 第23题:

    多选题
    Which two create an instance of an array?()
    A

    int ia = new int [15];

    B

    float fa = new float [20];

    C

    char ca = “Some String”;

    D

    Object oa = new float[20];

    E

    Int ia = (4, 5, 6) (1, 2, 3)


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

  • 第24题:

    多选题
    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
    解析: 暂无解析