• 网络学院
  • IT资讯
  • 操作系统
  • 网络技术
  • 软件应用
  • 办公软件
  • 编程技术
  • 网站架设
  • 数据库类
  • 平面设计
  • 多媒体类
  • 游戏资讯
  • 教学论文
  • 认证考试
格林模拟试题三参考答案(1)
  站点:
  • 首 页
  • 最新软件
  • 文章教程
  • 国内软件
  • 国外软件
  • 绿色软件
  • 源码下载
  • 字体下载
格林模拟试题三参考答案(1)
软件发布 格林模拟试题三参考答案(1)
网络软件 系统工具 应用软件 联络聊天 图形图像 多媒体类 行业软件 游戏娱乐 编程开发 安全相关 教育教学 数码软件 绿软下载
热门软件: QQ 瑞星 pplive e话通 木马克星 千千静听 office2000 五笔字根 Photoshop 视频分割
返回文章教程首页 >> 文章首页 >> 认证考试 >> JAVA认证 >> JAVA题库 >> 格林模拟试题三参考答案(1)

格林模拟试题三参考答案(1)

添加时间: 2007-9-22 7:04:03  作者: JAVA认证考试  阅读次数:41   来源: http://www.d9soft.com

       

Answers

Answer to Question 1)

1) float f=1/3;
2) int i=1/3;
4) double d=999d;

The fact that option 3 does not compile may be a surprise. The problem is because the default type for a number with a decimal component is a double and not a float. The additional trailing d in the option with 999 doesn't help, but it doesn't harm.

Answer to Question 2)

2) new

The option NULL (note the upper case letter) is definitely not a keyword. There is some discussion as to i. There is some discussion as to if null is a keyword but for the purpose of the exam you should probably assume it is a keyword.

The option instanceOf is a bit of a misleading option that would probably not occur on the exam. The real keyword is instanceof (note that the of has no capital letter O). I had the incorrect version in an earlier version of this tutorial as it looks more likely to my eyes. The instanceof keyword looks like a method, but it is actually an operator.

The option wend is probably valid in some other language to indicate the end of a while loop, but Java has no such keyword.

Answer to Question 3)

1) System.out.println(1+1);
2) int i=2+'2';
Option 3 is not valid because single quotes are used to indicate a character constant and not a string. Several people have emailed me to say that option 3 will compile. When they eventually compiled the exact code they have agreed, it will not compile. Let me re-state that

String s="on"+'one';

Will NOT compile.

Option 4 will not compile because 255 is out of the range of a byte
Answer to Question 4)
1) The garbage collection algorithm in Java is vendor implemented

Threading and garbage collection are two of the few areas that are platform dependent. This is one of the
reasons why Java is not suitable for realtime programming. It is not a good idea use it to control your
plane or nuclear power station. Once an instance of the Integer class has a value it cannot be changed.

Answer to Question 5)

(Not on the official sub objectives but this topic does come up on the exam)

2) The RandomAccessFile class allows you to move directly to any point a file.
4) The characteristics of an instance of the File class such as the directory separator, depend on the current underlying operating system

The File class can be considered to represent information about a file rather than a real file object. You can create a file in the underlying operating system by passing an instance of a file to a stream such as FileOutputStream. The file will be created when you call the close method of the stream.

Answer to Question 6)

2) The instanceof operator can be used to determine if a reference is an instance of a particular primitive wrapper class
 

The instanceof operator can only be used to make a static comparison with a class type. Java 1.1 added the isInstance method to the class Class to allow you to dynamically determine a class type. The exam does not test you on isInstance.

Answer to Question 7)

2) Interfaces cannot have constructors

If you try to create a constructor for an Interface the compiler will give you an error message something like

"interface can't have constructors".

4) Interfaces are the Java approach to addressing the single inheritance model, but require implementing classes to create the functionality of the Interfaces.

An interface may contain variables as well as methods. However any variables are final by default and must be assigned values on creation. A class can only extend one other class (single inheritance) but may implement as many interfaces as you like (or is sensible).

Answer to Question 8)

None of these are valid statements. The Math class is final and cannot be extended. The max method takes two parameters, round only takes one parameter and there is no mod parameter. You may get questions in the exam that have no apparently correct answer. If you are absolutely sure this is the case, do not check any of the options.


Answer to Question 9)

1) The Runnable interface has only one method run that needs to be created in any class that implements it. The start method is used to actually call and start the run method executing.

Answer to Question 10)

1) A byte can represent between -128 to 127

The char type is the only unsigned type in Java and thus cannot represent a negative number.

For more information on this topic go to

Answer to Question 11)

2) Compilation and no output at runtime

Because the method in Base called Base has a return type it is not a constructor and there for does not get called on creation of an instance of its child class In

For more information on this topic go to

Answer to Question 12)

4) Compilation and output of hello

This type of question is particularly calculated to catch out C/C++ programmers who might expect parameter zero to be the name of the compiler.

For more information on this topic go to

Answer to Question 13)

1) If a class has any abstract methods it must be declared abstract itself.
3) The final modifier means that a class cannot be sub-classed
4) transient and volatile are Java modifiers

An abstract class may have non abstract methods. Any class that descends from an abstract class must implement the abstract methods of the base class or declare them as abstract itself.

For more information on this topic go to

Answer to Question 14)

2) public static void amethod(){}
4) static native void amethod();

Option 1 is not valid because it has braces and the native modifier means that the method can have no body. This is because the body must be implemented in some other language (often C/C++). Option 3 is not valid because private and protected contradict themselves.

For more information on this topic go to

Answer to Question 15)

4) Constructors are not inherited

Constructors can be marked public, private or protected. Constructors do not have a return type.

For more information on this topic go to

Answer to Question 16)
 

2) Compile time error

An error occurs when the class Severn attempts to call the zero parameter constructor in the class Base Because the Base class has an integer constructor Java does not provide the "behind the scenes" zero parameter constructor.

For more information on this topic go to

 

上下文章:

 

上一篇文章: 格林模拟试题二参考答案(3) 下一篇文章: 格林模拟试题三参考答案(2)

相关文章:

  • 史上最强的几道oracle面试题
  • 国外公司的Oracle DBA试题
  • 今年4月三级数据库笔试试题及答案
  • Oracle DBA 逻辑备份试题选
  • 国外某公司的Oracle DBA试题

相关软件:

  • 全国计算机等级考试模拟软件(2006年全年使用)二级Visual Basic V9.0
  • 白金模拟炒股平台 V3.6
  • 全国计算机等级考试第21次全真模拟系统 20050311
  • 全国专业技术人员计算机应用能力考试模拟 2.1
  • 中考物理试卷分类试题 4.1
  • 计算机等级考试训练模拟软件(三级网络技术) V1.04

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • ASP源码
  • PHP源码
  • Net源码
  • JSP 源码

JAVA认证分类导航

  • JAVA动态
  • JAVA指导
  • JAVA题库

本类经典文章推荐

  • SCJP模拟试题[2](2)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](2)
  • SCJP Mock Exam 3(1)
  • SCJP考试题310-025[5](1)
  • Java网络编程之URI、URL研究专题一
  • Java认证模拟题及分析(1)
  • SCJP模拟试题[1](3)
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[2](3)

JAVA题库阅读排行

  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你4
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[1](2)
  • Java认证模拟题及分析(1)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](1)

JAVA认证阅读总排行

  • SCJP Mock Exam 2(2)
  • JAVA题库:考考你4
  • JAVA题库:考考你2
  • Java认证模拟题及分析(3)
  • SCJP考试真题和解析[1](2)
  • Java认证模拟题及分析(1)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)
  • SCJP模拟试题[2](1)
  • SCJP考试真题和解析[1](1)

广告位置

字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 回到顶部

关于我们 | 版权声明 | 免责条款 | 广告联系 | 软件发布 | 下载帮助 | 下载排行 | 网站地图 | 特别鸣谢 | 友情连接

copyright; 2005-2008 D9soft.com 第九软件网 版权所有