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

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

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

       

Answer to Question 33)

1) Java uses a system called UTF for I/O to support international character sets
3) An instance of FileInputStream may not be chained to an instance of FileOutputStream
4) File I/O activities requires use of Exception handling

Internally Java uses Unicode which are 16 bit characters. For I/O Java uses UTF which may be more thatn 16 bits per chamore thatn 16 bits per character.
Generally InputStreams can only be chained to other InputStreams and OutputStreams can only be chained to other OutputStreams. The piped streams are an exception to this.

Answer to Question 34)

1) Compile time error

It wil produce an error like "Abstract and native method can't have a body. This is typical of the more misleading question where you might think it is asking you about the circumstances under which the finally clause runs, but actually it is about something else.

Answer to Question 35)

2) Compilation and run with the output "Running"

This is perfectly legitimate if useless sample of creating an instnace of a Thread and causing its run method to execute via a call to the start method. The Thread class is part of the core java.lang package and does not need any explicit import statement. The reference to a Thread target is an attempt to mislead with a reference to the method of using the Runnable interface instead of simply inheriting from the Thread super class.

Answer to Question 36)

1) RandomAccessFile raf=new RandomAccessFile("myfile.txt","rw");

The RandomAccessFile is an anomaly in the Java I/O architecture. It descends directly from Object and is not part of the Streams architecture

Answer to Question 37)

2) public int amethod(int i, int j) {return 99;}
3) protected void amethod (long l){}
4) private void anothermethod(){}

Option 1 will not compile on two counts. One is the obvious one that it claims to return an integer. The other is that it is effectivly an attempt to redefine a method within the same class. The change of name of the parameter from i to z has no effect and a method cannot be overriden within the same class.

Answer to Question 38)

1) Code must be written to cause a frame to close on selecting the system close menu
2) The default layout for a Frame is the BorderLayout Manager
4) The GridBagLayout manager makes extensive use of the the GridBagConstraints class.

You can change the layout manager for a Frame or any other container whenever you like
  
Answer to Question 39)

4) The code will compile without error

There are no restrictions on the level of nesting for inner/nested classes. Inner classes may be marked private. The main method is not declared as public static void main, and assuming that the commandline was java Droitwich it would not be invoked anyway.

Answer to Question 40)

1) super.oak=1;
2) oak=33;
3) Base.oak=22;

Because the variable oak is declared as static only one copy of it will exist. Thus it can be changed either through the name of its class or through the name of any instance of that class. Because it is created as an integer it canot be assigned a fractional component without a cast.


Answer to Question 41)

Obje Question 41)

4) Use the getText method of a Textfield and use the parseInt method of the Integer class

Here is an example of how you might do this

Integer.parseInt(txtInputValue.getText());

I'm not sure that a question on this actually will come up in the exam but it is a very useful thing to know in the real world.


Answer to Question 42)

4) none of the above

The wrapper classes are immutable. Once the value has been set it cannot be changed. A common use of the wrapper classes is to take advantage of their static methods such as Integer.parseInt(String s) that will returns an integer if the the value has been set it cannot be changed. A common use of the wrapper classes is to take advantage of their static methods such as Integer.parseInt(String s) that will returns an integer if the String contains one.

Answer to Question 43)

2) constructors cannot be overriden

Overloading constructors is a key technique to allow multiple ways of initialising classes. By definition, constructors have have no return values so option 3 makes no sense. Option 4 is the inverse of what happens as constructor code will execute starting from the oldest ancestor class downwards. You can test this by writing a class that inherits from a base class and getting the constructor to print out a message. When you create the child class you will see the order of constructor calling.

Answer to Question 44)

yield is a static method and causes whatever thread is currently executing to yield its cycles.

1) t.yield();
2) Thread.yield()

(Thanks Roseanne )
Java Doc for the Thread class

Answer to Question 45)

4) Compilation and run with an output of 99

The fact that the variable court is declared as private does not stop the constructor from being able to initialise it.

Answer to Question 46)

3) To be overriden a method must have the same name, parameter and return types

Option 1 is a sneaky one in that it should read overriden not overloaded. An overriden method must also have the same return type. Parameter names are purely a programmer convenience and are not a factor in either overloading and overriding. Parameter order is a factor however.

Answer to Question 47)

1) Compile time error

With the sun JDK it will produce the following error

"Only constructors can invoke constructors".

If you took out the call to super that causes this error the program would compile and at runtime it would output Base and then Checket as constructors are called from the oldest ancestor class downwards.

Answer to Question 48)

1) Static methods cannot be overriden to be non static

The JDK1.1 compiler will issue an error message "static methods cannot be overriden" if you atempt to do thiuot; if you atempt to do this. There is no logic or atempt to do this. There is no logic or reason why private methods should not be overloaded or that static methods should not be declared private. Option 4 is a jumbled up version of the limitations of exceptions for overriden methods

Answer to Question 49)

2) A program can suggest that garbage collection be performed but not force it
4) A reference becomes eligable for garbage collection when it is assigned to null

If a program keeps creating new references without any being discarded it may run out of memory. Unlike most aspects of Java garbage collection is platform dependent.

Answer to Question 55)

1) Compile time error

This might be considered a "gocha" or deliberate attempt to mislead you because i has been given the data type of long and the parameter must be of long and the parameter must be either a byte, char, short or int. If you attempt to compile this code with JDK 1.2 you will get an error that says something like "Incompatible type for switch, Explicit cast needed to convert long to int". Answering with option 2 would have been reasonable because if the parameter had been an integer type the lack of break statements would have caused this output. If you gave either of the answers you should probably revise the subject.

Answer to Question 56)

1) System.out.println(i++);
3) System.out.println(i);
4) System.out.println(i==);

The options for this question might look suspiciously easy if you are not aware of the effects of the post-increment operators. The ++ and == operations for examples 1 and 4 only come into effect after the output operations, ie after whatever else is done to them on that line of code. Option 2 should be fairly obvious as you should know that the single quote characters indicate a char value, ie storing the character rather than the numberical value for 0.

Answer to Question 57)

4) System.out.println( ((Agg) a).getFields());

The Base type reference to the instance of the class Agg needs to be cast from Base to Agg to get access to its methods.The method invoked depends on the object itself, not on the declared type. So, a.getField() tries to invoke a getField method in Base which does not exist. But the call to ((Agg)a).getField() will invoke the getField() in the Agg class. You will be unlucky to get a question as complex as this on the exam. If you think option 1 is valid, have a go at compiling the code.
Answer to Question 58)

2) compilation and output of false

A variable defined at class level will always be given a default value and the default value for the primitive type boolean is false

Answer to Question 59)

1) The x,y coordinates of an instance of MouseEvent can be obtained using the getX() and getY() methods
4) The time of a MouseEvent can be extracted using the getWhen method

If you chose option 4, referring to the mythical getTime method you have made a reasonable guess based on the normal conventions of Java . However the conventions do not always hold true. If you chose option 3 perhaps you are not as aware of the conventions as you should be.

Answer to Question 60)

2) The program will run and output only "fliton"

This question tests your knowledge of the principle that the finally clause will almost always run.

 

上下文章:

 

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

相关文章:

  • 王微反击古永锵:数据是参考 赚钱最要紧
  • 用3ds max模拟香烟烟丝飘动的效果
  • EA公布《模拟人生3》海量游戏截图
  • 教你如何用PS滤镜巧妙模拟做出下雪效果
  • 史上最强的几道oracle面试题

相关软件:

  • 计算机等级考试训练模拟软件(三级数据库技术) V1.01
  • 历年高考化学试题库 V6.4 贺岁版
  • 中、高考英语试题库 V6.4 贺岁版
  • 全国计算机等级考试二级VFP上机考试模拟 V1.0
  • 交通法规模拟考试系统 V2006.2
  • 模拟Vista透明窗体 V1.6 绿色版

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • 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
  • SCJP考试真题和解析[1](2)
  • Java认证模拟题及分析(3)
  • Java认证模拟题及分析(1)
  • SCJP考试真题和解析[1](1)
  • SCJP模拟试题[2](1)
  • JAVA题库:格林模拟试题一(上)(2)
  • SCJP模拟试题[2](3)

JAVA认证阅读总排行

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

广告位置

字母检索 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 第九软件网 版权所有