1.Given:int x=3;
int y=1;
if (x=y){
System.out.printIn("x="+x);
}
What is the result?        (  )A.x=1  B.x=3   C.Compilationfails   D.An exception is thrown an runtime2.Which two are valid declarations within an interface definition?(Choose two)   (  )A.void methoda();
B.public double methoda();
C.public final double methoda();
D.static void methoda(double d1);
E.protected void methoda(double d1);3.You want to limit access to a method of a public class to members of the same class .Which access accomplishes this objective?  (   )A.public 
B.private
C.protected
D.transient
E.defult access4.Which retrieves all cookies sent in a given HttpServletRequest ? (   )A.request.getCookies()
B.request.getAttributes()
C.request.getSession().getCookies()
D.request.getSession().GetAttributes()5.Which two prevent a servlet from handling requests?(Choose two)(    )A.The servlet init method 后面看不清楚:(
B.The servlet init method throws a Servlet Exception
C.The servlet init method sets the Servlet Response's context length to   0
D.The servlet init methodsets the Servlet Response's content type to   null
E.The servlet init method does NOT return within a time period define by the servlet container
18. Given an HttpServletRequest  ,Which retrieves an object of type Account with an Id of"account"?(    )
A.Account account=request.get Resourse("account");
B.Account account=request.get Attribute("account");
C.Account account=request.get Parameter("account");
D.Account account=(Account)request.getResource("account");
E.Account account=(Account)request.get Attribute("account");
F.Account account=(Account)request.get Parameter("account");19.   Given: public void service (Http Servlet Reqest request,
                    Http Servlet Response response){
// your code here
 } Which code snippet inserted at "your code here" use the client to redirect to http://www.example.com? (   )A.response.send Redirect("http://www.example.com");
B.response.send Redirect(new URL ("http://www.example.com"));
C.Request Dispatcher rd=get Servlet Context().Get Request Dispatcher("http://www.example.com");
  rd.forward(request.Response);
D.Request Dispatch rd=Get Servlet Context().get Request Dispatcher(New URL("http://www.example.com"));
  Rd.forward(request.response);20. A class type is define as final in java, what does it mean?___________________________________________________________________21.Program:Write a functionto get sting,the rule is the following.When you input a string parameter and a byte number parameter,you get a new string output witch is splitted from the string  parameter  by  the byte number  parameter length.The Chinese characters should not be splitted to half.For example, when you input "我ABC" and 4, you get "我AB". When you input "我ABC汉DEF" and 6, you get "我ABC" but not "我ABC"  plus half of"汉".22. The relationship model between providers and hardware is SP(Sno,Pno,Qty),Sno represent the NO,of the provider,Pno represent the NO. of the hardware,Qty represent the count of the hardware.To query the provider NO.whose hardware include all of the‘168’provide, the SQL is the following.
    SELECT Sno
      FROM SP SPX
      WHERE (1)(       )
      (SELECT*
         FROM SP SPY

解决方案 »

  1.   

    1. C
    Java中整型不可以作boolean值使用。
      

  2.   

    1. C  if (x=y)
    2.AB(only public & abstract)
    3.ABC都不可以,D
    4.C
    5.
    18.E
    19.A
    20.The Class can't be inherited.
    21.应该是让你写一个有两个参数的方法,第一个参数是目标字符串,第二个是游标的位置,如果是汉字沾两字节的话,不能分开返回,就从汉字前一个字节返回。楼主自己想想先。
    22。看不懂the provider NO.whose hardware include all of the‘168’provide。
      

  3.   

    1c 
    2ab
    3c
    4a
    5bd
    18e
    19ac
    20 means "not inherit"
    21
    public class TestStr{
        public void splitStr(String s ,int length){
         try{
         int num = count(s.substring(0,length));
                if(num>1){
                 num=num-1;
                }
                int locate = length-num;
                
                System.out.println (num);
                String temp = s.substring(0,locate);
                int j = temp.charAt(temp.length()-1);
                if(j>255){
                 temp = s.substring(0,locate-1);
                }
                System.out.println (temp);
         }catch(Exception e){
         e.printStackTrace();
         }
        
        }
        public int count(String s){
         int count = 0;
         for (int i = 0; i<s.length(); i++){
         char a = s.charAt(i);
         int j = a;
         if(j>255){
         count++;
         }
         }
         return count;
        }
        public static void main(String[] args) {
         TestStr ts = new TestStr();
         String str="我ABC汉DEF";
            ts.splitStr(str,4);
            
        }
    }
      

  4.   

    You want to limit access to a method of a public class to members of the same class这句话看不太懂,怎么翻译?