多选题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

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given that: Gadget has-a Sprocket and Gadget has-a Spring and Gadget is-a Widget and Widget has-a Sprocket Which two code fragments represent these relationships? ()

A.

B.

C.

D.

E.

F.


参考答案:A, C

第2题:

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

第3题:

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

第4题:

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

第5题:

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

第6题:

You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()

  • A、MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;} %>
  • B、MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { . MY_ARRAY[${i}] = ’${serverArray[i]}’;. } %>
  • C、MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;. <% } %>
  • D、MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[${i}] = ’${serverArray[i]}’;. <% } %>

正确答案:C

第7题:

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

第8题:

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 */ }


参考答案:B, C, E

第9题:

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

第10题:

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

更多相关问题