zoukankan      html  css  js  c++  java
  • 曾经的面试试题

    Java   Basic   Level  
      In   this   part,   you   will   have   20   minutes   to   finish   30   multiple-choice   questions.          
       
      1.     How   many   methods   does   the   MouseMotionListener   interface   define  
      A)     2    
      B)     5  
      C)   10  
      D)     7  
         
      2.   A   skeleton   is  
      A)   A   thread,   which   has   been   created,   but   not   yet   started  
      B)   A   base   class,   which   can   be   extended   to   make   a   complete   application    
      C)   The   definition   of   an   object,   which   will   be   used   on   a   server   via   RMI  
      D)   A   thread,   which   is   no   longer   accessible   from   the   main   method    
         
      3.   Java   is  
      A)   A   set   of   programmer's   libraries  
      B)   A   programming   language  
      C)   A   widget   set   for   programmers  
      D)   A   network   service    
       
      4.   What   would   I   use   a   StringBuffer   for  
      A)   StringBuffers   are   deprecated;   arrays   of   characters   should   be   used   instead  
      B)   For   reading   in   a   line   so   I   don't   have   to   handle   it   byte-by-byte  
      C)   Building   up   and   manipulating   a   character   string   that   needs   to   be   changed   dynamically    
      D)   Writing   text   efficiently   to   a   network   so   that   it's   not   sent   byte-by-byte    
         
      5.   System.out.print('\u0066');   will   display   on   your   screen:      
      A)   Capital   Epsilon  
      B)   The   digit   "6"  
      C)   Lower   case   "o"   with   an   Umlaut  
      D)   A   lowercase   letter   "f"  
       
      6.   RMI   is  
         
      A)   A   way   of   having   a   Java   program   or   applet   on   one   computer   use   Java   methods   and   objects   that   are   residing   on   another   computer    
      B)   The   recommended   way   of   having   multiple   invocations   of   the   same   program   running   on   a   single   system  
      C)   A   Java   application   for   remote   access   to   Microsoft   servers   via   the   Internet  
      D)   The   pre-cursor   of   Java,   now   largely   superceded  
           
      7.   Which   of   these   is   a   reserved   word   in   Java  
        A)   while  
      B)   when  
      C)   which  
      D)   what  
         
      8.   To   find   how   wide   a   character   string   will   appear   in   your   AWT   window,   use  
      A)   the   getWidth   method   on   a   FontMetrics   object  
      B)   multiple   calls   to   the   charWidth   method   on   a   FontMetrics   object  
      C)   the   stringWidth   method   on   a   FontMetrics   object  
      D)   the   getLength   method   on   a   FontMetrics   object  
         
      9.   What   value   is   left   in   the   variable   ttimes   after   running   this   code  
      String   Quiz   =   "Some   test   text";  
      int   ttimes   =   0;  
      for   (int   stepper=0;   stepper<Quiz.length()-1;   stepper++)  
          if   (Quiz.charAt(stepper)   ==   't')   ;  
            &bsp;++ttimes;    
      A)   4  
      B)   11  
      C)   3  
      D)   12  
      E)   0  
      F)   13  
      H)   1  
      I)   2  
      J)   5  
       
      10.   A   class   file   is  
      A)   A   file   that   contains   a   section   of   compiled   Java   code   which,   with   other   class   files,   can   be   used   to   run   a   Java   application  
      B)   A   file   that   contains   a   set   of   security   rules   to   ensure   that   Java   can't   be   used   to   distribute   viruses  
      C)   A   file   that   is   written   by   trainees   on   our   courses  
      D)   A   file   that   contains   a   library   of   methods   and   objects  
         
      11.   Threads   are   used  
      A)   Only   to   hold   the   seams   in   the   programmer's   trousers  
      B)   As   a   debugging   tool   to   allow   the   programmer   to   trace   back   once   a   Java   program   has   completed   its   operation  
      C)   To   maintain   multiple   contexts  
      D)     To   allow   a   Java   program   to   do   several   things   at   the   same   time    
      12.   What   is   sent   to   System.out   by   this   code  
      int   val   =   11;  
      System.out.print("Result:   "+val+1);  
      A)   111  
      B)   11  
      C)   12  
         
      13.   the   statement   int   []   counts   =   new   int   [26];  
      A)   Creates   a   pointer   to   an   integer   array,   but   doesn't   actually   allocate   any   memory   for   it.   A   maximum   size   of   26   numbers   is   set   for   later   use  
      B)   Creates   an   array   object   that   can   hold   up   to   26   whole   numbers    
      C)   Creates   an   array   object,   initially   with   enough   memory   allocated   to   hold   26   numbers.   But   this   will   be   extended   automatically   if   you   go   past   the   end   of   the   array  
      D)   Creates   an   array   object   that   can   hold   up   to   27   whole   numbers   (positions   0   through   26)    
       
      14.   An   applet   is      
      A)   A   piece   of   Java   running   within   a   web   browser  
      B)   An   application   which   isn't   invoked   directly   by   the   user,   but   is   called   up   from   within   another   application   as,   and   when,   required  
      C)   A   short   application   program   which   resides   completely   in   a   single   file  
      D)   A   piece   of   Java   which   is   only   allowed   to   produce   graphic   output   and   cannot   write   to   the   screen   in   any   other   way  
       
      15.   Which   of   the   following   is   a   Java   primitive   variable   type  
      A)   Integer  
      B)   int  
      C)   integer    
       
      16.   A   Java   program   typically   runs  
      A)   Faster   than   a   program   written   in   a   shell   script   language,   but   slower   than   a   program   in   a   native   language   such   as   C  
      B)   Faster   than   anything   else   on   the   same   computer  
      C)   About   the   same   speed   as   a   program   written   in   a   native   language   such   as   C,   and   much   faster   than   a   shell   script  
      D)   Slower   than   programs   in   shell   script   languages,   but   with   modern   computers   that   isn't   a   problem  
       
      17.   How   many   interfaces   can   you   implement   in   a   new   class   at   one   time  
      A)   Java   does   not   set   a   limit  
      B)   1  
      C)   2   (one   via   "implement"   and   one   via   "extend")  
      D)   None  
       
      18.   If   you   extend   a   class,   you   are  
      A)   allocating   more   memory   to   the   class  
      B)   creating   extra   instances   of   the   class  
      C)   creating   a   subclass  
      D)   making   a   class   more   generic  
       
      19.   If   you   want   to   print   a   number   out   to   two   decimal   places,   you   would   use  
      A)   The   method   System.out.Printf  
      B)   A   tokenizer  
      C)   A   decimalFormat   object  
      D)   the   setCurrency   method   with   a   single   parameter   of   type   float   or   double  
       
      20.   In   order   to   use   a   bean,   you   need   access   to  
      A)   The   .class   file   for   the   bean  
      B)   A   .java   file   for   the   bean  
      C)   A   beanbox,   such   as   Sun's   BDK  
      D)   A   secure   connection   to   a   server,   or   a   signed   certificate  
       
      21.   Which   of   these   is   a   predefined   colour  
      A)   Color.teal  
      B)   Color.darkGray  
      C)   Color.grey  
      D)   Color.fuschia  
       
      22.   Resource   bundles   are   a   convenient   way   to  
      A)   Collect   settings   together   for   database   access,   so   that   you   don't   have   to   keep   respecifying   unchanged   parameters   for   each   SQL   query  
      B)   Group   AWT   components   so   that   they're   laid   out   neatly   on   the   screen  
      C)   Translate   messages,   keystrokes,   short   cuts,   etc   into   a   variety   of   different   languages  
      D)   Obtain   classes   for   use   in   your   Java   programs,   knowing   they'll   be   written   to   a   specific   standard.   It's   also   a   good   way   to   encourage   others   to   reuse   your   classes  
       
      23.   In   order   to   distribute   Java   applets,   you   require  
      A)   A   Java-enabled   web   server  
      B)   The   applet   in   .class   format  
      C)   A   licensed   copy   of   the   Java   Development   Kit,   which   comes   with   the   appropriate   rights   for   any   programs   you   create   using   it  
      D)   A   Unix   or   Linux   workstation   which   (in   practice)   would   have   a   permanent   link   to   the   internet  
       
      24.   An   exception   is   always  
      A)   generated   if   you   try   to   write   to   STDOUT   in   an   applet  
      B)   an   instance   of   class   Throwable  
      C)   flagged   by   the   compiler  
      D)   used   to   indicate   that   your   program   has   failed   to   work   correctly  
       
      25.   Which   of   these   is   NOT   a   simple   data   type  
      A)   boolean  
      B)   String  
      C)   double  
      D)   byte  
       
      26.   In   order   to   move   smoothly   from   one   graphics   frame   to   the   next,   you   need  
      A)   to   use   java.awt.zbuffer   rather   than   java.awt.graphics   components  
      B)   to   draw   to   an   offscreen   canvas   and   then   copy   the   canvas   in   a   single   call   to   the   drawImage   method  
      C)   to   be   able   to   "undraw"   moving   objects   from   their   old   position   on   the   screen   just   before   you   redraw   them   in   their   new   position  
      D)   a   "double   buffered"   frame   buffer   card  
       
      27.   In   order   to   store   an   object   directly   in   a   file,   it   must   be  
      A)   Transient  
      B)   Serialisable  
      C)   Either   Public   or   Protected  
      D)   Synchronised  
       
      28.   Untrusted   code   (i.e.   that   has   been   downloaded   by   a   browser)   can   ONLY   do   one   of   the   following.   Which  
      A)   Read   the   os.name   system   property   to   find   the   name   of   the   operating   system   it   is   running   on  
      B)   Read   the   user.name   system   property   so   that   it   can   address   the   user   by   name  
      C)   Read   files   which   are   marked   as   publicly   readable   from   the   local   file   system  
      D)   Create   directories  
       
      29.   If   I   want   to   compare   the   two   strings   in   the   variables   "one"   and   "two"   to   see   if   the   contents   of   the   strings   are   identical,   which   do   I   write  
      A)   if   (one.equals(two))  
      B)   if   (one   ==   two)  
      C)   if   (one   eq   two)  
      D)   if   ((one-two)   ==   0)  
       
      30.   How   do   you   obtain   the   IP   address   of   the   machine   your   Java   program   is   running   on  
      A)   Use   the   getHostbyNumber()   method   on   a   String   object,   where   the   string   contains   the   word   "localhost".  
      B)   Use   the   NameService.getClient()   method  
      C)   Use   the   InetAddress.getLocalHost()   method  
      D)   Use   the   host.number   System   Property   directly   
       
    这个参考答案不一定正确,因为是多选题:
      1.a   2.c   3.b   4.c   5.f  
      6.c   7.a   8.a   9.c   10a  
      11.d   12.a   13.a,14   15b  
      16d   17a   18d   19c   20.a  
      21.b   22.a   23c   24d   25b  
      26.b   27b   28a   29a   30c  

  • 相关阅读:
    CF 7C. Line(扩展欧几里德)
    HDU 1700 Points on Cycle(向量旋转)
    POJ 1673 EXOCENTER OF A TRIANGLE(垂心)
    SRM 594 DIV1 250
    Codeforces Round #207 (Div. 1) A. Knight Tournament(STL)
    POJ 1654 Area(水题)
    POJ 1474 Video Surveillance(半平面交)
    POJ 1473 There's Treasure Everywhere!
    POJ 1329 Circle Through Three Points(三角形外心)
    POJ 1279 Art Gallery(半平面交)
  • 原文地址:https://www.cnblogs.com/zijinguang/p/1134965.html
Copyright © 2011-2022 走看看