首 页 网络编程
网页制作 图形图象 操作系统 冲浪宝典
软件教学 认证考试

网络安全 网络办公 行业资讯 评测对比
您当前位置:站长天空 -> 软件教学-> 压缩工具
java程序员认证模拟题及详细分析(3)_java认证
作者:网友供稿 点击:0
推荐
西部数码-全国虚拟主机10强!20余项虚拟主机管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!可在线rar解压,自动数据恢复设置虚拟目录等.免费赠送访问统计,企业邮局.Cn域名注册10元/年,自助建站480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金
站内搜索
文章页数:[1] 
续:Java程序员认证模拟题及分析(1) 和(2)
   51. Which correctly create an array of five empty Strings?
   A. String a[] = new String[5];
   for (int i=0;i<5;a[i++]=””);
   B. String a []={“”,””,””,””,””};
   C. String a[5];
   D. String [5] a;
   E. String [] a = new String[5];
   for (int i = 0 ;i<5;a[i++] = null);

   52. Which cannot be added to a Container?
   A. an Applet
   B. a Component
   C. a Container
   D. a MenuComponent
   E. a panel

   53. Which is the return value of Event listener?s method?
   A. String B. AWTEvent C. void D. int

   54. If we implements MouseListener, which is corrected argument of its method? (short answer)

   55. Use the operator “>>” and “>>>”. Which statement is true?
   A. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give
   0000 1010 0000 0000 0000 0000 0000 0000
   B. 1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give
   1111 1010 0000 0000 0000 0000 0000 0000
   C. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give
   0000 1010 0000 0000 0000 0000 0000 0000
   D. 1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give
   1111 1010 0000 0000 0000 0000 0000 0000

   56. Give following fragment.
   Outer: for(int i=0; i<3; i++)
   inner:for(int j=0;j<3;j++){
   If(j>1)break outer;
   System.out.println(j+”and”+i);
   }
   Which will be output?
   A. 0 and 0 B. 0 and 1 C. 0 and 2 D. 0 and 3
   E. 1 and 0 F. 1 and 1 G. 1 and 2 H. 1 and 3
   I. 2 and 0 J. 2 and 1 K. 2 and 2 L. 2 and 3

   57. Examine the following code which includes an inner class:
   public final class Test4 implements A{
   class Inner{
   void test(){
   if (Test4.this.flag);{
   sample();
   }
   }
   private boolean flag=false;
   }
   public void sample(){
   System.out.println(“Sample”);
   }
   public Test4(){
   (new Inner()).test();
   }
   public static void main(String args[]){
   new Test4();
   }
   }
   What is the result:
   A.Print out “Sample”
   B.Program produces no output but termiantes correctly.
   C. Program does not terminate.
   D.The program will not compile

   58. What is written to the standard output given the following statement:
   System.out.println(4|7);
   Select the right answer:
   A.4
   B.5
   C.6
   D.7
   E.0

   59. Look the inheritance relation:
   person
|
----------------
| |
man woman
   In a source of java have the following line:
   person p=new man();
   What statement are corrected?
   A. The expression is illegal.
   B. Compile corrected but running wrong.
   C. The expression is legal.
   D. Will construct a person?s object.
   60. Look the inheritance relation:
   person
|
----------------
| |
man woman
   In a source of java have the following line:
   woman w=new man():

   What statement are corrected?
   A. The expression is illegal.
   B. Compile corrected but running wrong.
   C. The expression is legal.
   D. Will construct a woman object.

   61. Which can NOT be used in declaring or declaring and initializing an automatic (method local) variable?
   A. final
   B. static
   C. expressions
   D. Constants of non-primitive type
   E. initialized arrays (such as “ {“Hello”,”Good bye”}”).

   62. Given the following incomplete method:
   1) public void method(){
   2)
   3) if (someTestFails()){
   4)
   5) }
   6)
   7) }
   You want to make this method throw an IOException if,and only if,the method someTestFails() returns a value of true.
   Which changes achieve this?
   A. Add at line 2:IOException e;
   B. Add at line 4:throw e;
   C. Add at line 4:throw new IOException();
   D. Add at line 6:throw new IOException();
   E. Modify the method declaration to indicate that an object of type Exception might be thrown.
   63. Given the following definition:
   String s = null;
   Which code fragments cause an object of type NullPointerException to be thrown?
   A. if((s!=null)&(s.length()>0))
   B. if((s!=null)&&(s.length()>0))
   C. if((s==null)|(s.length()==0))
   D. if((s==null)||(s.length()==0))

   64. The following is a program
   1) class Exsuper{
   2) String name;
   3) String nick_name;
   4)
   5) public ExSuper(String s,String t){
   6) name = s;
   7) nick_name = t;
   8) }
   9)
   10) public string toString(){
   11) return name;
   12) }
   13) }
   14)
   15) public class Example extends ExSuper{
   16)
   17) public Example(String s,String t){
   18) super(s,t);
   19) }
   20)
   21) public String to String(){
   22) return name +”a.k.a”+nick_name;
   23) }
   24)
   25) public static void main(String args[]){
   26) ExSuper a = new ExSuper(“First”,”1st”);
   27) ExSuper b = new Example(“Second”,”2nd”);
   28)
   29) System.out.println(“a is”+a.toString());
   30) System.out.println(“b is”+b.toString());
   31) }
   32) }
   What happens when the user attempts to compile and run this program?
   A. A Compiler error occurs at line 21
   B. An object of type ClassCastException is thrown at line 27
   C.The following output:
   a is First
   b is second
   D. The following output:
   a is First
   b is Secong a.k.a 2nd
   F. The following output:
   a is First a.k.a 1st
   b is Second a.k.a 2nd

   65. Which statements are true about Listeners?
   A. At most one listener can be added to any simple Component.
   B. The return value from a listener is used to control the invocation of other listener
   C. If multiple listeners are added to a single component, they must all be made friends to each other
   D. If multiple listeners are added to single component, the order of invocation of the listener is not specified.
   E. In the AWT, listener methods generally take an argument, which is an instance of some subclass of java.awt.AWTEvent class.

答案及详细分析:
51。A、B
注意,每个对象变量在未初始化前都为“null”,并不为“空”。当为“空”时,它已经被分配具体内存空间了,与“null”有本质的区别。
52。D
菜单控件只能添加到叫做菜单容器的特殊对象中,而且布局管理器对菜单控件不起任何作用。
53。C
事件监听器方法就是句柄方法,所有句柄方法的访问权限都是public,返回值类型都是void。
54。MouseEvent
此题是考试中常见的题型。一般来说,句柄方法的参数类型与监听器类型是匹配的,只有监听器MouseMotionListener的句柄方法的参数类型是MouseEvent,与相应监听器类型名称不匹配。
55。B、C
“>>” 是带符号右移,高位是“1”则补“1”,否则补“0”;“>>>”是无符号右移,又叫补零右移,不论高位是什么,都是补“0”。
56。A、E
注意标号的使用。另外,break表示跳出本语句块的执行,continue继续本块的执行。
57。A
回答此题时,要仔细阅读程序,注意到语句“if(Test4.this.flag);”有一分号,这是没有执行语句的条件语句,所以“sample()”方法总是被调用。
58。D
“|”是按位或运算符,先将4和7转为二进制数。转换后就是计算“100|111”,所以得到结果是“111”,转为十进制整形数是7。此题提醒考生注意,要熟悉各种运算符号的含义。
59。C
这是多态性的定义方式,p是父类引用指向子类对象。此时,编译器认为p是一个person,而不是man ,所以p只能实现父类的功能。但是当p调用被覆盖方法时,是指向子类中的该方法。
60.A
多态性的定义允许父类引用指向子类对象,但是不允许两个平等的子类有这样的操作。所以该表达式是不合法的。
61.B
自动变量前不能用“static”修饰。
以下定义都是允许的:
final Date d = new Date();
String [] s = {“Hello”,”abc”};
int i = x+4;
所以只有B选项是正确。
62.C、E
所有自定义异常,在方法体中抛出了,就必须在方法声明中抛出。所以除了C选项外,E也必须入选。
63.A、C
逻辑运算符“&&”、“||”,在运算中有“短路”行为:例如 A&&B,如果A的值为false,则直接将整个表达式的值置为false,对B的值不加考察。而运算符“&”、“|”就没有这种行为。所以在选项A、C中,“s.length()”会导致抛出空指针异常。
64.D
源程序的第27行,是多态性的定义。对象b调用被覆盖方法时是调用子类中的该方法。
65.D、E
一个控件可以注册多个监听器,并且事件的响应没有特定的顺序。句柄方法的参数是类AWTEvent类的子类。

文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

文章页数:[1] 


放大字体显示 缩小字体显示 打印文章 推荐给朋友
热门文章
·web打印的另类方法-ASP教程,打印相关
·Java简单类型进行精确浮点数运算-JSP教程,Java技巧及代码
·使用JAVAMAIL发邮件的一个例子-JSP教程,邮件相关
·中国移动本地传输网建设方案初探
·传输系统中的时钟同步技术
·JSP学习经验总结(转)-JSP教程,Jsp/Servlet
·WEB打印,去页眉和页脚-ASP教程,打印相关
·Native XML数据库技术详解-.NET教程,XML应用
·jsp生成html--readtemplates-JSP教程,Jsp/Servlet
·下拉框反回选定的文字 (修改页面经常用到)-ASP教程,ASP应用
最新文章
·在xp中如何使用windows vista屏保_windows xp
·photoshop调色:cmyk模式处理单色调特效_photoshop教程
·视频分享网站视频广告发展面临的问题_营销推广
·难以置信,这样的网站每月盈利上千万_营销推广
·大站做百度主题推广 小站做google adsense_网赚技巧
·方兴东:保留alexa插件才能给站长带来快乐_站长访谈
·网友天下ceo叶灵:欢迎大家看web2.0笑话_站长访谈
·我们应该如何运营网站_站长心得
·网站从业者还要更加务实才能赚钱_站长心得
·炼成高级网络编辑的三大原则_站长心得
相关主题
  • java程序员认证模拟题及详细分析(4)_java认证
  • java程序员认证模拟题及详细分析(2)_java认证
  • java程序员认证模拟题及详细分析(1)_java认证
  • JAVA程序的性能优化-JSP教程,Java技巧及代码
  • JAVA程序员必读:基础篇(4)类和继承-JSP教程,Java技巧及代码
  • 西部数码虚拟主机

    友情链接
    CNNIC 西部数码
    万网 自助建站
    虚拟主机 asp空间
    域名注册 域名
    域名申请 主页空间
    论坛空间 网站空间
    国际域名 虚拟空间
    空间租用 DDOS防火墙
    成都主机托管 四川主机托管
    主机租用 服务器租用
    网站目录 自助建站
    虚拟主机 网址大全
    软件下载
    自助链接
    虚拟主机资讯 特价虚拟主机
    版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
    关于我们:站长天空:专业提供最新的站长资讯、在线教程、虚拟主机权威评测、虚拟主机性能对比、网站制作教程,开发教程,站长工具。包括网页制作教程、冲浪宝典、编程参考、操作系统、软件教学、行业动态等。
    特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
    发表评论 打印  刷新     关闭