复习题目

Set1_Question

 

1. Which two of the following situations will result in the init() method of a servlet being invoked?

A. Every time a new client accesses the servlet

B. When the server automatically reloads the servlet

C. When a HTTP INIT type request is made by a client

D. When the servlet is put into service after loading and instantiation

 

2. If a server has URL rewriting enabled, what is the result of using the encodeURL() method of the HttpResponse interface?

A. Encryption of sensitive client data in the URL

B. Increased performance due to browser specific information being encoded in the URL

C. Redirection of all subsequent requests to a unique domain specified as a URL parameter

D. Addition of a client's session ID to the URL in a query string

 

 

3. A developer wants to measure how many times a servlet has been invoked. Which listener could be used to accomplish this task?

A. HttpSessionListener

B. ServletContextListener

C. ServletRequestListener

D. ServletRequestAttributeListener

 

4. A Web application contains a single servlet that handles all types of requests. Within the Web application there is an HTML page that contains a form that uses a POST type request. There are also hyperlinks with query strings associated with them. The servlet must handle both HTML form and hyperlink requests. Which two methods of the HttpServlet class should be overridden by the servlet programmer?

A. doGet()

B. doPut()

C. doPost()

D. doQuery()

E. doForm()

 

5.

 

Given:

 String foo = “blue”;

 Boolean[]bar = new Boolean [1];

 if (bar[0]) {

 foo = “green”;

 }

What is the result?

 

A. Foo has the value of “”

B. Foo has the value of null.

C. Foo has the value of “blue”

D. Foo has the value of “green”

E. An exception is thrown.

F. The code will not compile.

 

6.

Exhibit:

 public class X {

      public static void main (String[]args) {

      String s1 = new String (“true”);

      Boolean b1 = new Boolean (true);

      if (s1.equals(b1)) {

      System.out.printIn(“Equal”);

                      }

                                  }

               }

What is the result?

A. The program runs and prints nothing.

B. The program runs and prints “Equal”

C. An error at line 5 causes compilation to fail.

D. The program runs but aborts with an exception.

 

 

7.

 

Given:

 public class Foo {

 public static void main (String []args) {

 int i = 1;

 int j = i++;

 if ((i>++j) && (i++ ==j)) {

 i +=j;

 }

 }

 }

 

What is the final value of i?

A. 1

B. 2

C. 3

D. 4

E. 5

 

8.Exhibit:

 public class X {

 public static void main (String[]args) {

 string s = new string (“Hello”);

 modify(s);

 System.out.printIn(s);

 }

 

 public static void modify (String s) {

 s += “world!”;

 }

 }

 

What is the result?

A. The program runs and prints “Hello”

B. An error causes compilation to fail.

C. The program runs and prints “Hello world!”

D. The program runs but aborts with an exception.

 

9.sleep() wait() 有什么区别?

 

10.Math.round(11.5)等於多少? Math.round(-11.5)等於多少?

 

11.有状态session bean与无状态session bean的区别?

 

12.EJBJAVA BEAN的区别?

 

13.HashMapHashtable的区别?

 

以下の問題1620を○×で回答してください。

 

問題14

1つのクラスに同じ名前のメソッドがあると、コンパイルエラーになる。

 

問題15

JDK1.4で、メソッドが引数を必要とする場合、引数を指定しないと、コンパイルエラーになる。

 

問題16

メソッドは、複数の戻り値を返すことができない。

 

問題17

下記プログラムの実行結果は、どのようになりますか?(A~Eの中から1つ選択)

11行目.int x = 1,y = 6;

12行目.while(y--) {

13行目. x++;

14行目.}

15行目.System.out.println("x="+ x + "y=" + y);

 

A.画面にx=6y=0と表示される。

B.画面にx=7y=0と表示される。

C.画面にx=6y=-1と表示される。

D.画面にx=7y=-1と表示される。

E.コンパイルエラーになる。

 

問題18

下記プログラムの実行結果は、どのようになりますか?(A~Eの中から1つ選択)

class sample {

 public static void main(String args[]) {

    int i=0;

  for(; i<4; i+=2) {

   System.out.print( i );

  }

    System.out.print( i );

 }

 

}

 

A.画面に024と表示される。

B.画面に0245と表示される。

C.画面に01234と表示される。

D.コンパイルエラーになる。

E.実行時に例外が発生する。

 

 

table1table2の例データです                                    

table1                           table2            

id    seq   value              id    seq   value

id001      1     111         id001      3     a

id001      2     222         id001      2     b

id002      1     111         id002      1     c

id002      3     222         id002      3     d

                                                                            

table2のデータをtable1に登録する(ただし、seqという項目調整要)                                                                                

この公式の内

■【2】の意味 はtable1id001内、最大のseq2

■【1】の意味 はtable2id001内、このレコードのseqは一番小さい

 

■次の公式も同じように類推する

                                      

上記の例は、table1は結果的に下記のように変更される                                       

赤字が新しく登録されるデータ                                         

                                         

table1                                        

id    seq   value                           

id001      1     111                      

id001      2     222                      

id001      3     b         2+1=3           

id001      4     a          2+2=4           

id002      1     111                      

id002      3     222                      

id002      4     c          3+1=4           

id002      5     d         3+2=5           

                                         

       下記の二つ選択肢を一つを選択して実現方法を考えています。                                  

1     Javaプログラムをマイン方法として上記の登録を実現する                                  

2     SQLをマイン方法として上記の登録を実現する(複数のSQL可)                             

                                         

※注意、上記に書いたtableのデータが例だけです、実際のデータがそうではない            

       なので、id='id001'などのロジックを避けてください                               

       一般的なロジックで実装してください          

 

 

Select tab1.id,tab1.seq,tab1.value from table1 tab1 left join table2 tab2 on

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ホワイトボックステスト                 

①単体テストケースを洗い出してください。                    

※年度というのは、例えば、2011年度は2011・4・1~2012・3・31ということです。                    

       private String getYearArray(int count){             

              StringBuffer buf = new StringBuffer();      

              String rdoReferClass = getParameter("rdoReferClass"); //画面から取得      

 

              StringBuffer bufTmp ;  

 

              Calendar cal = GPRCommon.getFiscalYearObj(); //戻り値:YYYY年度のみが含むCalendarオブジェクト。    

              SimpleDateFormat df = new SimpleDateFormat("yyyy"); 

 

              for (int i = 0; i < count; i++){     

                     buf.append("'"+df.format(cal.getTime())+"'");

                     bufTmp = new StringBuffer();

                     bufTmp.append(df.format(cal.getTime()));

 

                     if(rdoReferClass.equals("Monthly")){  

                            iMonthArr[i]=Integer.parseInt(bufTmp.toString());

                     } else {  

                            iYearArr[i]=Integer.parseInt(bufTmp.toString());

                     }    

                     if((i + 1) < count){

                            buf.append(",");

                            cal.add(Calendar.YEAR,-1);

                     }    

              }           

              return buf.toString();           

       }    

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ブラックボックステスト

②下記の画面を見るだけで、単体テストケースを洗い出してください。

                                

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值