更多“多选题Which two are valid and equivalent?()A%! int i; %B%= int i; %Cjsp:exprint i;/jsp:exprDjsp:scriptletint i;/jsp:scriptletEjsp:declarationint i;/jsp:declaration”相关问题
  • 第1题:

    有以下程序: include using namespace std; int f(int); int main() {int i;for(i=0;

    有以下程序:

    include <iostream>

    using namespace std;

    int f(int);

    int main()

    {

    int i;

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

    cout<<f(i)<<" ";

    return 0;

    }

    int f(int i)

    {

    static int k=1;

    for(;i>0;i--)

    k+=i;


    正确答案:1 2 5 11 21
    1 2 5 11 21 解析:函数f()中定义了一个内部静态变量k,其作用域仍在定义它的函数内。但该类型变量采用静态存储分配,当函数执行完,返回调用点时,该变量并不撤销,其值将继续保留,若下次再进入该函数时,其值仍然存在。内部静态变量有隐含初值0,并且只在编译时初始化一次。

  • 第2题:

    有以下程序:include define N 20fun(int a[] ,int n,int m){int i,j;for(i=m;i> :n;i

    有以下程序: #include <stdio.h> #define N 20 fun(int a[] ,int n,int m) { int i,j; for(i=m;i> :n;i--) a[i+1] =a[i]; } main( ) { int i,a[N.] = 11,2.3,4,5,6,7,8,9,10[; fun( a,2,9) for(i =0;i<5;i ++ ) printf("% d" ,a[i] );程序运行后的输出结果是( )。

    A.10234

    B.12344

    C.12334

    D.12234


    正确答案:C
    解析:本题函数fun的作用是将指定的数组元素(下标从n~m)向后移一位。调用函数fun(a,2,9)将a[2]到a[9]的各元素依次向后移一位,最后a数组中各元素的值分别为1,2,3,3,4,5,6,7,8,9,10,程序输出数组的前5个元素:12334。

  • 第3题:

    下列有关指针的用法中,错误的是( )。

    A.int i;int *p=&i;

    B. int i;int *p;i=*p;

    C. int *p;p=0;

    D.int i=5;int *p;p=&i;


    正确答案:B
    解析:“int i;”语句为定义了一个整型变量i。“int *p”为定义一个整型指针p。选项A) 中的“int *p=&i;”是定义整型指针变量p,并指向整型i的地址。选项B) 中“i=*p”语句是将p指向的变量赋值给i,而指针p没有初始化,所以选项B) 错误。选项C) 中“p=0;”表示p指向0的地址。选项D) 中“&i”为取i的地址,并赋值给p。

  • 第4题:

    编写JSP小脚本,实现访问该JSP时,在会话对象中保存int型变量i的有效语句是()。

    • A、session.setAttribute(i,”I”)
    • B、session.setParameter(“I”,i)
    • C、session.setAttribute(new Integer(i),”I”)
    • D、session.setAttribute(“I”,new Integer(i))

    正确答案:D

  • 第5题:

    ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()

    • A、 for (int i=0; i< a.size(); i++)     System.out.println(a.get(i)));
    • B、 for (int i=0; i< a.size(); i++)     System.out.println(a[i]);
    • C、 while( iter.hasNext() )     System.out.println(iter.next()) ;
    • D、 for (int i=0, i< a.size(); i++)    System.out.println(iter[i]);
    • E、 for (int i=0; i< a.size(); i++)    System.out.println(iter.get(i));

    正确答案:A,C

  • 第6题:

    Which are syntactically valid statement at// point x?()     class Person {     private int a;  public int change(int m){  return m;  }     }  public class Teacher extends Person {     public int b;  public static void main(String arg[]){     Person p = new Person();     Teacher t = new Teacher();    int i;  // point x     }    } 

    • A、 i = m;
    • B、 i = b;
    • C、 i = p.a;
    • D、 i = p.change(30);
    • E、 i = t.b.

    正确答案:D,E

  • 第7题:

    Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  

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

    正确答案:B,C

  • 第8题:

    Which two are valid and equivalent?()

    • A、<%! int i; %>
    • B、<%= int i; %>
    • C、<jsp:expr>int i;</jsp:expr>
    • D、<jsp:scriptlet>int i;</jsp:scriptlet>
    • E、<jsp:declaration>int i;</jsp:declaration>

    正确答案:A,E

  • 第9题:

    多选题
    Which two are valid and equivalent?()
    A

    <%! int i; %>

    B

    <%= int i; %>

    C

    <jsp:expr>int i;</jsp:expr>

    D

    <jsp:scriptlet>int i;</jsp:scriptlet>

    E

    <jsp:declaration>int i;</jsp:declaration>


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

  • 第10题:

    单选题
    编写JSP小脚本,实现访问该JSP时,在会话对象中保存int型变量i的有效语句是()。
    A

    session.setAttribute(i,”I”)

    B

    session.setParameter(“I”,i)

    C

    session.setAttribute(new Integer(i),”I”)

    D

    session.setAttribute(“I”,new Integer(i))


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

  • 第11题:

    单选题
    Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains:   What is the result?()
    A

    <b></b>

    B

    <b>12</b>

    C

    The JSP fails to execute.

    D

    <% int i = 12 %><b><%= i %></b>


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

  • 第12题:

    单选题
    for( int i = min; i 
    A

     init i = min;while( i < max ){}

    B

     int i = min;     do    system.out.println(i++);    } while( i< max );

    C

     for (int i=min; i

    D

     for (int i=; i++


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

  • 第13题:

    Giventheelementfromthewebapplicationdeploymentdescriptor:<jsp-property-group><url-pattern>/main/page1.jsp</url-pattern><scripting-invalid>true</scripting-invalid></jsp-property-group>andgiventhat/main/page1.jspcontains:<%inti=12;%><b><%=i%></b>Whatistheresult?()

    A.<b></b>

    B.<b>12</b>

    C.TheJSPfailstoexecute.

    D.<%inti=12%><b><%=i%></b>


    参考答案:C

  • 第14题:

    阅读以下说明及C++程序代码,将应填入(n)处的语句写在对应栏内。

    【说明】

    本程序的功能是实现任意两个大整数的乘法运算,例如:

    输入整数1:8934793850094505800243958034985058

    输入整数2:234584950989689084095803583095820923

    二者之积:

    209596817742739508050978890737675662366433464256830959194834854876 8534

    【C++代码】

    include<iostream.h>

    const int MAXINPUTBIT=100;

    const int MAXRESULTBIT=500;

    class LargeNumber{

    int i,j;

    int temp;

    int one[MAXINPUTBIT+1];

    int onebit; //one的位数

    int two[MAXINPUTBIT+1];

    int twobit; //two的位数

    int result[MAXRESULTBIT+1];

    public:

    LargeNumber();

    ~LargeNumber();

    int inputone(); //出错返叫0,否则返回1

    int inputtwo(); //同上

    void multiplication(); //乘

    void clearresult(); //清零

    void showresult(); //显示

    };

    LargeNumber∷LargeNumber()

    {

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

    {

    one[i]=0;

    two[i]=0;

    }

    nebit=0;

    twobit=0;

    inputone();

    inputtwo();

    }

    LargeNumber∷~LargeNumber()

    {

    }

    int LargeNumber∷inputone()

    {

    char Number[MAXINPUTBIT+1];

    cout<<"Please enter one:";

    cin>>Number;

    i=0;

    j=MAXINPUTBIT;

    while(Number[i]!='\0')

    i++;

    nebit=i;

    for(i--;i>=0;i--,j--)

    {

    if(int(Number[i])>=48&&int(Number[i])<=57)

    (1); //由字符转换为数字

    else

    return 0;

    }

    return 1;

    }

    int LargeNumber∷inputtwo()

    {

    char Number[MAXINPUTBIT+1];

    cout<<"Please enter two:";

    cin>>Number;

    i=0;

    j=MAXINPUTBIT;

    while(Number[i]!='\0')

    i++;

    twobit=i;

    for(i--;i>=0;i--,j--)

    {

    if(int(Number[i])>=48&&int(Number[i])<=57)

    two[j]=int(Number[i]-48); //由字符转换为数字

    else

    return 0;

    }

    return 1;

    }

    void LargeNumber∷multiplication() //乘法

    {

    clearresult();

    int m;

    for(i=MAXINPUTBIT;i>=0;i--)

    {

    temp=two[i];

    for(j=(2),m=MAXINPUTBIT;m>=0;m--,j--)

    {

    result[j]+=temp*one[m];

    if(result[j]>9)

    {

    result[j-1]+=result[j]/10;

    (3);

    }

    }

    &n


    正确答案:(1)one[j]=int(Number[i]-48) (2)MAXRESULTBIT-(MAXINPUTBIT-i) (3)result[j]%=10 (4)result[i] (5)result[i]=0
    (1)one[j]=int(Number[i]-48) (2)MAXRESULTBIT-(MAXINPUTBIT-i) (3)result[j]%=10 (4)result[i] (5)result[i]=0 解析:本题考查用C++实现大整数的乘法运算。
    题目要求程序能实现从键盘任意输入的两个大整数的乘法运算。在程序中定义了一个大整数类,在类中抽象了大整数的一些属性,如长度等,还声明了一些操作,有对大整数输入的操作和对大整数求乘积的操作等。下面来具体[分析]程序。
    第(1)空在第一个大整数的输入函数中,根据此空后面的注释我们知道,其功能是把字符转换为数字。在这里需要注意的是,从键盘输入的是字符型的一串字符,此空所在的条件判断语句是用来把这串字符中的数字找出来,接下来就是此空,要求把字符型的数字转换为整型的数字,而字符型数字与整型数字之间的ASCⅡ码值相差48。从第二个大整数的输入函数中,我们也可以很容易知道此空答案为one[j]=int(Number[i]-48)。
    第(2)空在对大整数求乘积的函数中,是一个循环的初始条件,从程序中不难看出,这个二重循环是用来实现对两个大整数求乘积的,而变量j是用来存放计算结果数组的当前下标的,根据乘法的规则,不难得出此空答案为MAXRESULTBIT-(MAXINPUTBIT-i)。
    第(3)空也在求积的二重循环中,它是在语句if(result[j]>9)为真的情况下执行的语句,如果这个条件为真,说明当前需要进位,但到底是进几位,进位后余下的数又应该是多少呢?这就是这个条件判断语句下要完成的任务,从程序中不难看出,对于到底进几位这个问题已经解决,剩下的就是对进位后余数的处理,此空的任务就是求出进位后的余数并存放到数组的当前位置。所以,此空答案为result[j]%=10。
    第(4)空在输出计算结果的函数中,从程序中可以看出,此空在_个循环中,循环的作用是输出计算结果,而计算结果存放在数组中,因此,这个循环是用来输出数组中的所有元素。因此,此空答案为result[i]。
    第(5)空是在清除计算结果的函数中,函数中只有一个循环,此空就在循环下面,计算结果存放在数组中,要清除计算结果就是把数组清零,那么此空的任务是把数组中的每个元素变成零,因此,此空答案为result[i]=0。

  • 第15题:

    For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()

    • A、<jsp:declaration>int count = 0;<jsp:declaration>
    • B、<%! int count = 0; %>
    • C、<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>
    • D、<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>

    正确答案:A

  • 第16题:

    下面代码  在J2EE中,aa.jsp文件如下 <%!  Starci  int I=0;  int j=0;%>    <% for ( ; I++<2;) method_  { out.pringt(j++) ; out.print(“   ”);} %>      <%! i="0;" int="" j="0;%" starci="">      <% for="" method_="" />{ out.pringt(j++) ; out.print(“   ”);} %> 有两个客户依次使用浏览器浏览aa.jsp,且每个客户只浏览aa.jsp依次, 那么第二个客户看到浏览器显示()。

    • A、 0  1
    • B、 1 2
    • C、 3  4
    • D、5  6
    • E、 什么也没有

    正确答案:A

  • 第17题:

    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

  • 第18题:

    Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains: <% int i = 12; %> <%= i %>  What is the result?()

    • A、<b></b>
    • B、<b>12</b>
    • C、The JSP fails to execute.
    • D、<% int i = 12 %><b><%= i %></b>

    正确答案:C

  • 第19题:

    for( int i = min; i 

    • A、 init i = min;while( i < max ){}
    • B、 int i = min;     do    system.out.println(i++);    } while( i< max );
    • C、 for (int i=min; i
    • D、 for (int i=; i++

    正确答案:B

  • 第20题:

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

  • 第21题:

    多选题
    Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }
    A

    Definition a.

    B

    Definition b.

    C

    Definition c.

    D

    Definition d.

    E

    Definition e.


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

  • 第22题:

    单选题
    Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains:   What is the result?()
    A

    <b></b>

    B

    <b>12</b>

    C

    The JSP fails to execute.

    D

    <% int i = 12 %><b><%= i %></b>


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

  • 第23题:

    多选题
    ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()
    A

    for (int i=0; i< a.size(); i++)     System.out.println(a.get(i)));

    B

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

    C

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

    D

    for (int i=0, i< a.size(); i++)    System.out.println(iter[i]);

    E

    for (int i=0; i< a.size(); i++)    System.out.println(iter.get(i));


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

  • 第24题:

    单选题
    For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()
    A

    <jsp:declaration>int count = 0;<jsp:declaration>

    B

    <%! int count = 0; %>

    C

    <jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>

    D

    <jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>


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