单选题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[<

题目
单选题
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]}’;. <% } %>


相似考题
参考答案和解析
正确答案: D
解析: 暂无解析
更多“单选题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[%= ”相关问题
  • 第1题:

    You are writing a method to compress an array of bytes.The array is passed to the method in a parameter named document.You need to compress the incoming array of bytes and return the result as an array of bytes.Which code segment should you use?()

    A.

    B.

    C.

    D.


    参考答案:C

  • 第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题:

    int [] my_Array;   My_Array=new int [5];   For(int count = 0 ;  count <=5; count ++)    System.out.pringtln(my_Array[count]);   以上Java代码运行的结果是()  

    • A、将1,2,3,4,5输出到屏幕
    • B、将0,1,2,3,4输出到屏幕
    • C、将0,1,2,3,4,5输出到屏幕
    • D、将出现运行时异常

    正确答案:D

  • 第4题:

    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

  • 第5题:

    To take advantage of the capabilities of modern browsers that use web standards, such as XHTML andCSS, your web application is being converted from simple JSP pages to JSP Document format. However,one of your JSPs, /scripts/screenFunctions.jsp, generates a JavaScript file. This file is included in severalweb forms to create screen-specific validation functions and are included in these pages with the followingstatement: 10. 11.  14. 15. Which JSP code snippet declares that this JSP Document is a JavaScript file?()

    • A、<%@ page contentType=’application/javascript’ %>
    • B、<jsp:page contentType='application/javascript' />
    • C、<jsp:document contentType='application/javascript' />
    • D、<jsp:directive.page contentType='application/javascript' />
    • E、No declaration is needed because the web form XHTML page already declares the MIME type of the /scripts/screenFunctions.jsp file in the <script> tag.

    正确答案:D

  • 第6题:

    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

  • 第7题:

    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

  • 第8题:

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

  • 第9题:

    多选题
    You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()
    A

    In the init method.

    B

    In the jspInit method.

    C

    In the constructor of the JSP’s Java code.

    D

    In a JSP declaration, which includes an initializer block.

    E

    In a JSP declaration, which includes a static initializer block.


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

  • 第10题:

    单选题
    int [] my_Array;  my_Array = new int[5];  for(int count = 0; count <= 5; count++)  System.out.println(my_Array[count]); 结果是()
    A

    将1,2,3,4,5输出到屏幕

    B

    将0,1,2,3,4输出到屏幕

    C

    将0,1,2,3,4,5输出到屏幕

    D

    将出现运行时异常


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

  • 第11题:

    单选题
    int[]my_Array; my_Array=newint[5]; for(intcount=0;count<=5;count++)System.out.println(my_Array[count]); 以上Java代码运行的结果是()。
    A

    将1,2,3,4,5输出到屏幕

    B

    将0,1,2,3,4输出到屏幕

    C

    将0,1,2,3,4,5输出到屏幕

    D

    将出现运行时异常


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

  • 第12题:

    ( 难度:中等)var emp = new Array(3); for(var i in emp) 以下答案中能与for循环代码互换的是:
    A.for(var i =0; i<emp; i++)
    B.for(var i =0; i<Array(3); i++)
    C.for(var i =0; i<emp.length(); i++)
    D.for(var i =0; i<emp.length; i++)

    答案:D

  • 第13题:

    有以下程序: include include usingnamespacestd; intmain() {intarrays

    有以下程序: #include <iostream> #include <cstdlib> using namespace std; int main() { int arraysize; int *array; cout<<"Please input the size of the array:"; cin>>arraySiZe; array=new int[arraysize]; if(array==NULL) { cout<<"allocate Error\n"; exit(1); } for(int i=0;i<arraysize;i++) array[i]=i*i; int j; cout<<"which element you want to check:"; cin>>j; cout<<array[j]<<end1; return 0; } 执行程序输入:10<空格>5,则输出结果为( )。

    A.allocate Error

    B.1

    C.0

    D.25


    正确答案:D
    解析:程序中利用new()申请动态分配数组。利用for循环给数组array赋值。最后输出想要检查元素的值。程序输10,即数组array元素个数为10。程序输入5,即检查元素array[5]的值。由for循环的赋值运算可知array[5]的值为25,所以程序最后输出25。

  • 第14题:

    下列程序用于打印出ASCⅡ字符,其析构函数内的语句应为【 】。 include inelude

    下列程序用于打印出ASCⅡ字符,其析构函数内的语句应为【 】。

    include<iostream. h>

    inelude<iomanip, h>

    template<class T>

    class Array

    {

    T * elems;

    int size;

    public:

    Array(int.s);

    ~Array()

    T& operator[](int)

    void perator=(T)

    };

    template<class T>

    Array<T>::Array(int s)

    size=s;

    elems=new T[size]

    for(int i=0;i<size;i++)

    elems[i]=0

    }

    template<celass T>

    Array<T>::~Array()

    {

    ______

    template <class T>

    T& Array<T>::operator[](int index)

    {

    return elems[index];

    }

    template<class T>

    void Array<T>::operator=(T temp)

    {

    for(int i=0;i<size;i++)

    elems[i]=temp;

    }

    void main()

    {

    int i,n=26;

    Array<int> arr1(n)

    Array<char> arr2(n)

    for(i=0;i<n;i++)

    { -.

    arr1[i]='a'+i;

    arr2[i]='a'+i;

    }

    cout<<"ASCII 字符"<<endl;

    for(i=0;i<n;i++)

    cout<<setw(8)<<arr1[i]<<setw(8)<<arr2[i]<<endl;

    }


    正确答案:delete elems;
    delete elems; 解析:注意,用new动态申请的内存在使用完成后一定要用delete释放。

  • 第15题:

    int [] my_Array;  my_Array = new int[5];  for(int count = 0; count <= 5; count++)  System.out.println(my_Array[count]); 结果是()

    • A、将1,2,3,4,5输出到屏幕
    • B、将0,1,2,3,4输出到屏幕
    • C、将0,1,2,3,4,5输出到屏幕
    • D、将出现运行时异常

    正确答案:D

  • 第16题:

    You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()

    • A、In the init method.
    • B、In the jspInit method.
    • C、In the constructor of the JSP’s Java code.
    • D、In a JSP declaration, which includes an initializer block.
    • E、In a JSP declaration, which includes a static initializer block.

    正确答案:B,D,E

  • 第17题:

    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

  • 第18题:

    1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()

    • A、 String s = strings.get(0);
    • B、 Iterator i1 = strings.iterator();
    • C、 String[] array1 = strings.toArray();
    • D、 Iterator i2 = strings.iterator();
    • E、 String[] array2 = strings.toArray(new String[1]);
    • F、 Iterator i3 = strings.iterator();

    正确答案:A,B,D,E

  • 第19题:

    单选题
    有如下程序:#includevoid change(int * array,int len){ for(;len>=0;len--)array[len]-=1;}main(){ int i, array[5]={2,2}; change(array,4); for(i=0;i<5;i++)printf("%d,",array[i]); printf("");}程序运行后的输出结果是(  )。
    A

    1,1,-1,-1,-1,

    B

    1,0,-1,1,-1,

    C

    1,1,1,1,1,

    D

    1,-1,1,-1,1,


    正确答案: A
    解析:
    在main()函数中,首先给一维数组array赋初值[2,2,0,0,0],再调用change函数,对array数组中的每一个数进行减1处理,最后使用for循环语句输出数组元素的值,答案选择A选项。

  • 第20题:

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

    A

    B

    B

    C

    C

    D

    D


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

  • 第21题:

    单选题
    有如下程序: #include  void change(int *array,int len) {  for(;len>=0;len--)   array[len]+=2; } main() {  int i,array[5]={1,2};  change(array,4);  for(i=0;i<4;i++)   printf("%d,",array[i]);  printf(""); } 程序运行后的输出结果是(  )。
    A

    2,3,4,5,

    B

    3,4,5,6,

    C

    3,4,2,2,

    D

    1,2,0,0,


    正确答案: A
    解析:
    本题程序执行过程为:调用change函数,将数组array={1,2,0,0,0}首地址传入函数,函数实现将数组每个元素加2,arrray={3,4,2,2,2}。依次输出数组前4个元素为3、4、2、2。答案选择D选项。

  • 第22题:

    单选题
    To take advantage of the capabilities of modern browsers that use web standards, such as XHTML andCSS, your web application is being converted from simple JSP pages to JSP Document format. However,one of your JSPs, /scripts/screenFunctions.jsp, generates a JavaScript file. This file is included in severalweb forms to create screen-specific validation functions and are included in these pages with the followingstatement: 10. 11.  14. 15. Which JSP code snippet declares that this JSP Document is a JavaScript file?()
    A

    <%@ page contentType=’application/javascript’ %>

    B

    <jsp:page contentType='application/javascript' />

    C

    <jsp:document contentType='application/javascript' />

    D

    <jsp:directive.page contentType='application/javascript' />

    E

    No declaration is needed because the web form XHTML page already declares the MIME type of the /scripts/screenFunctions.jsp file in the <script> tag.


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

  • 第23题:

    单选题
    int [] my_Array;   My_Array=new int [5];   For(int count = 0 ;  count <=5; count ++)    System.out.pringtln(my_Array[count]);   以上Java代码运行的结果是()
    A

    将1,2,3,4,5输出到屏幕

    B

    将0,1,2,3,4输出到屏幕

    C

    将0,1,2,3,4,5输出到屏幕

    D

    将出现运行时异常


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