niusouti.com

考虑下面的代码片段。?phpdefine(‘STOP_AT’,1024);$result = array();/在此处填入代码/{$result[]=$idx;}print_r($result);标记处填入什么代码才能产生如下的数组输出?( )Array([0]=1[1]=2[2]=4[3] =8[4] =16[5] =32[6] =64[7] =128[8] =256[9] =512)A.foreach($result as $key =$val)B.while($idx=2) C.for($idx=1

题目
考虑下面的代码片段。?phpdefine(‘STOP_AT’,1024);$result = array();/在此处填入代码/{$result[]=$idx;}print_r($result);标记处填入什么代码才能产生如下的数组输出?( )Array([0]=1[1]=2[2]=4[3] =8[4] =16[5] =32[6] =64[7] =128[8] =256[9] =512)

A.foreach($result as $key =$val)

B.while($idx=2) C.for($idx=1 D.$idxSTOP_AT E.$idx=2)

F.for($idx*=2

G.STOP_AT=$idx

H.$idx=0)


相似考题
更多“考虑下面的代码片段。?phpdefine(‘STOP_AT’,1024);$result = array();/在此处填入代码/{$result[]=$idx;}print_r($result);标记处填入什么代码才能产生如下的数组输出?( )Array([0]=1[1]=2[2]=4[3] =8[4] =16[5] =32[6] =64[7] =128[8] =256[9] =512) ”相关问题
  • 第1题:

    下面代码是实现数组array冒泡排序的片段,划线处应填入() int[] array = { 60, 56, 38, 45 }; int temp; for (int i = 0; i < 3; i++) { for (int j = 0; j < __________; j++) { if (array[j] < array[j + 1]) { temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; } } }

    A.i

    B.i+1

    C.4-i

    D.3-i


    3-i

  • 第2题:

    3、创建2个数组:a = np.array([1,2,3]),b = np.array([[1,2,3],[4,5,6],[7,8,9]]),执行a+b,运行结果为_______。

    A.array([[ 2, 4, 6], [ 4, 5, 6], [7, 8, 9]])

    B.array([ 2, 4, 6])

    C.array([[ 2, 4, 6], [ 5, 7, 9], [ 8, 10, 12]])

    D.数组a、b维度不同,无法相加


    ABCD

  • 第3题:

    下面的方法,当参数值为2的时候返回值是多少 1. public int getValue(int i) { 2. int result = 0; 3. switch (i) { 4. case 1: 5. result = result + i; 6. case 2: 7. result = result + i * 2; 8. case 3: 9. result = result + i * 3; 10. } 11. return result; 12. }

    A.10

    B.8

    C.6

    D.4

    E.2

    F.0


    错误

  • 第4题:

    4.下面代码片断的输出结果是什么? byte b = 10; char c = 'b'; short s = 100; int i = 4, result1 = b * c; int result2 = ++i - b-- + s++; System.out.println("c=" + (byte) c); System.out.println("result1=" + result1); System.out.println("result2=" + result2);


    1.0

  • 第5题:

    执行下面的代码后,输出结果为()。$K = array(array(1 ,2),array("ab","cd")); echo count($x,1);

    A.2

    B.4

    C.6

    D.8


    显示最后四个测量值的平均值