电信主站 网通分站
购买流程 付款方式 常见问题 在线提问 续租服务 购物车
用户名: 密 码: 忘记密码?
首 页
域名注册
虚拟主机
双线主机
服务器租用
VPS主机
企业邮局
代理专区
客服中心
虚拟主机行业资讯 虚拟主机评测对比 互联网最新动态 技术学院 站长资讯 在线教程 网站运营
搜索优化 服务器 网络编程 图形图象 站长之家 网页制作 操作系统
冲浪宝典 软件教学 视频通信 办公软件 邮件系统 网络安全 认证考试
您当前位置:西部数码->资讯中心-> 认证考试-> Java认证
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.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
相关主题
文章页数:[1] 
Google
热门文章
·java认证的目的和步骤_java认证
·sun java it技术认证问题解答_java认证
·scjp认证套题解析之一_java认证
·jcreater+motoj2sdk的配置与使用心得_java认证
·java语言入门(2)_java认证
·java语言入门(1)_java认证
·在java中使用正则表达式_java认证
·java语言特点及开发工具jdk_java认证
·热门问题:java.exe出错错误分析_java认证
·java中的测不准原理_java认证

最新文章
·photoshop简单为美女照片瘦身及调色_photoshop教程
·photoshop模仿龟裂的瓷纹杯_photoshop教程
·photoshop绘鲜美葡萄 表现光影效果_photoshop教程
·java认证培训辅导:随机整数的生成_java认证
·java考试认证:scjp310-035考试心得_java认证
·通过java认证 scjp 考试之精辟总结_java认证
·java认证心得:顺利通过scjp测试全接触_java认证
·java认证培训辅导:随机整数的生成_java认证
·利用photoshop通道计算模拟反转负冲效果_photoshop教程
·linux下安装apache与php_php教程


 
 


版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
  打印  刷新  关闭
返回首页 |关于我们 | 联系我们 | 付款方式 | 创业联盟 | 虚拟主机 | 资讯中心 | 友情链接 | 网站地图

版权所有 西部数码(www.west263.com)
CopyRight (c) 2002~2006 west263.com all right reserved.
公司地址:四川成都市万和路90号天象大厦4楼 邮编:610031
电话总机:028-86262244 86263048 86263408 86263960 86264018 86267838
售前咨询:总机转201 202 203 204 206 208
售后服务:总机转211 212 213 214
财务咨询:总机转224 223 传真:028-86264041 财务QQ:点击发送消息给对方635483282
售前咨询QQ:点击发送消息给对方2182518 点击发送消息给对方241975952 点击发送消息给对方275026793 点击发送消息给对方408235859
售后服务QQ:点击发送消息给对方17708515 点击发送消息给对方307742704 点击发送消息给对方287976517 点击发送消息给对方363783715
《中华人民共和国增值电信业务经营许可证》编号:川B2-20030065号