首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

求这几道题的答案,再次多谢大家了!很着急多谢了!

2012-01-20 
求这几道题的答案,再次谢谢大家了!!!很着急,谢谢了!!!!!!!!!!!!!!Question1Whichdesignpatternisusedtodec

求这几道题的答案,再次谢谢大家了!!!很着急,谢谢了!!!!!!!!!!!!!!
Question   1
Which   design   pattern   is   used   to   decouple   presentation   from   core   data   access   functionality?
❍   A.   Business   Delegate
❍   B.   Data   Access   Object
❍   C.   Model-View-Controller
❍   D.   Value   Object
Question   2
Which   design   pattern   is   used   to   minimize   coupling   between   presentation-tier   clients   and   the   application   service   API?
❍   A.   Business   Delegate
❍   B.   Data   Access   Object
❍   C.   Model-View-Controller
❍   D.   Value   Object


Question   2)
What   will   happen   if   you   try   to   compile   and   run   the   following   code  
public   class   MyClass   {  
                public   static   void   main(String   arguments[])   {  
                                amethod(arguments);  
                                }  
                public   void   amethod(String[]   arguments)   {  
                                System.out.println(arguments);  
                                System.out.println(arguments[1]);  
                }  
}
1)   error   Can 't   make   static   reference   to   void   amethod.  
2)   error   method   main   not   correct  
3)   error   array   must   include   parameter  
4)   amethod   must   be   declared   with   String  


Question   5
Read   the   following   code   snippet.
<taglib>
<taglib-uri>
http://www.yourcompany.com/yourTagLibrary
</taglib-uri>
<taglib-location>
/WEB-INF/yourTagLibrary.tld
</taglib-location>
</taglib>
What   statement   applies   to   this   code   snippet?
&#10061;   A.   The   tablib   element   of   the   deployment   descriptor   is   required   if   you   use   a   taglib   directive   in   a   JSP   page   that   references   a   TLD   by   name   (indirectly)   rather   than   by   location   (directly).
&#10061;   B.   This   tag   goes   into   the   WEB-INF/myApplication/web.xml   file.
&#10061;   C.   This   definition   is   incorrect   because   the   taglib-uri   should   have   been   uri.
&#10061;   D.   This   definition   is   incorrect   because   the   taglib   should   have   been   tag.



Question   7
How   do   you   declare   initialization   parameters   for   the   servlet   in   the   deployment
descriptor?
&#10061;   A.
<web-app>
<servlet>
<servletname> servletName </servletname>
<servletclass> com.myCo.MyServlet </servletclass>
<initparam>
<paramname> color </paramname>
<paramvalue> blue </paramvalue>
</initparam>
</servlet>
</web-app>
&#10061;   B.
<web-app>
<servlet>
<servlet-name> servletName </servlet-name>
<servlet-class> com.myCo.MyServlet </servlet-class>
<init-param>
<name> color </name>
<value> blue </value>
</init-param>
</servlet>
</web-app>
&#10061;   C.
<web-app>
<servlet>
<name> servletName </name>
<class> com.myCo.MyServlet </class>
<init-param>
<param-name> color </param-name>
<param-value> blue </param-value>
</init-param>
</servlet>
</web-app>
&#10061;   D.
<web-app>
<servlet>
<servlet-name> servletName </servlet-name>
<servlet-class> com.myCo.MyServlet </servlet-class>
<init-param>
<param-name> color </param-name>
<param-value> blue </param-value>
</init-param>
</servlet>
</web-app>


Question   29
Which   two   statements   are   true   regarding   a   distributable?   (Choose   two.)
&#10065;   A.   A   given   ServletContext   instance   may   exist   on   different   JVMs.
&#10065;   B.   Servlet   context-init   parameters   are   not   likely   to   be   shared   across   different
JVMs.
&#10065;   C.   A   different   ServletContext   instance   may   exist   on   different   JVMs.
&#10065;   D.   Servlet   context-init   parameters   are   likely   to   be   shared   across   different
JVMs.
Question   11)
What   will   be   the   result   of   attempting   to   compile   and   run   the   following   code?  
abstract   class   MineBase   {  
                abstract   void   amethod();  
                static   int   i;  
}
public   class   Mine   extends   MineBase             {  
                public   static   void   main(String   argv[]){  
                                                int[]   ar=new   int[5];  
                                                for(i=0;i   <   ar.length;i++)  
                                                        System.out.println(ar[i]);  


                                                }  
}
1)   a   sequence   of   5   0 's   will   be   printed  
2)   Error:   ar   is   used   before   it   is   initialized  
3)   Error   Mine   must   be   declared   abstract  
4)   IndexOutOfBoundes   Error  

Question   15)
What   will   be   output   if   you   try   to   compile   and   run   the   following   code,   but   there   is  
no   file   called   Hello.txt   in   the   current   directory?.  
import   java.io.*;  

public   class   Mine   {  

                public   static   void   main(String   argv[]){
                Mine   m=new   Mine();  

                System.out.println(m.amethod());  

}
public   int   amethod()   {  

                try   {

                                FileInputStream   dis=new   FileInputStream( "Hello.txt ");  

                                }catch   (FileNotFoundException   fne)   {  

                                                System.out.println( "No   such   file   found ");  

                                                return   -1;  

                                                }catch(IOException   ioe)   {  

                                                }   finally{  

                System.out.println( "Doing   finally ");  

                }  

                return   0;  

                }  

}
1)   No   such   file   found  
2   No   such   file   found   ,-1  
3)   No   such   file   found,   Doing   finally,   -1  
4)   0  
Question   16)
Which   of   the   following   statements   are   true?  
1)   Methods   cannot   be   overriden   to   be   more   private
2)   Static   methods   cannot   be   overloaded


3)   Private   methods   cannot   be   overloaded
4)   An   overloaded   method   cannot   throw   exceptions   not   checked   in   the   base   class

Question   17)
What   will   happen   if   you   attempt   to   compile   and   run   the   following   code?  
1)   Compile   and   run   without   error  
2)   Compile   time   Exception  
3)   Runtime   Exception  
class   Base   {}  

class   Sub   extends   Base   {}  

class   Sub2   extends   Base   {}
public   class   CEx{
                public   static   void   main(String   argv[]){

                                Base   b=new   Base();

                                Sub   s=(Sub)   b;

                                }
}

Question   43)

What   will   be   the   result   when   you   try   to   compile   and   run   the   following   code?  
private   class   Base{

Base(){

          int   i   =   100;          

          System.out.println(i);

          }

}

public   class   Pri   extends   Base{

static   int   i   =   200;

public   static   void   main(String   argv[]){

                Pri   p   =   new   Pri();

                System.out.println(i);

                }

}
1)   Error   at   compile   time  
2)   200  
3)   100   followed   by   200  
4)   100  
Question   58)

You   have   these   files   in   the   same   directory.   What   will   happen   when   you   attempt   to   compile   and   run   Class1.java   if   you   have   not   already   compiled   Base.java  
//Base.java
package   Base;

class   Base{

                protected   void   amethod(){

                                System.out.println( "amethod ");

                }//End   of   amethod

}//End   of   class   base
package   Class1;
//Class1.java

public   class   Class1   extends   Base{


public   static   void   main(String   argv[]){

                                Base   b   =   new   Base();



                                b.amethod();

                              }//End   of   main

}//End   of   Class1
1)   Compile   Error:   Methods   in   Base   not   found  
2)   Compile   Error:   Unable   to   access   protected   method   in   base   class  
3)   Compilation   followed   by   the   output   "amethod "  
4)Compile   error:   Superclass   Class1.Base   of   class   Class1.Class1   not   found  


[解决办法]
Question 15)
3) No such file found, Doing finally, -1
Question 16)
Private methods cannot be overloaded
Question 17)
Compile and run without error
Question 43)
1) Error at compile time
Question 58)
Compilation followed by the output "amethod "
[解决办法]
Question 2): 1)
Question 7 : D
Question 11): 3)
Question 15): 3)
Question 16): 4)
Question 17): 3)
Question 43): 1)
Question 58): 4)
[解决办法]
question 1): B
question 2): c MVC
question 2): error Can 't make static reference to void amethod.
[解决办法]
Question 1: C
Question 2: C
Question 3: 1
Question 5: D
Question 7: D
Question 29: BC
Question 11: 3
Question 15: 3
Question 16: 3
Question 17: 1
Question 43: 1
Question 58: 3


[解决办法]
翻译过来看嘛!
[解决办法]
Question 1: 3
Question 2: 4
Question 3: 1
Question 5: 4
Question 7: 4
Question 29: 3
Question 11: 3
Question 15: 3
Question 16: 3
Question 17: 1
Question 43: 1
Question 58: 3
[解决办法]
这贴应该封!!!!!!!!!!!!!!!!!!!!!!

热点排行