Which are most typically thrown by an API developer or an
application developer as opposed to being thrown by the JVM? (Choose all that apply.)
A. ClassCastException
B. IllegalStateException
C. NumberFormatException
D. IllegalArgumentException
E. ExceptionInInitializerError
请选择: A B C D E
答案:B C D
Which declarations of identifiers are legal?
A. $persons
B. TwoUsers
C. *point
D. this
E. _endline
请选择: A B C D E
答案:A B E
点评:Java的标识符可以以一个Unicode字符,下滑线(_),美元符($)开始,后续字符可以是前面的符号和数字,没有长度限制,大小写敏感,不能是保留字。
class BaseClass{
private float x=1.0f;
private float getVar(){return x;}
}
class SubClass extends BaseClass{
private float x=2.0f;
//insert code
}
what are true to override getVar()?
A.float getVar(){
B.public float getVar(){
C.public double getVar(){
D.protected float getVar(){
E.public float getVar(float f){
请选择: A B C D E
答案:A B D
点评:参数列表和返回值以及方法名(好像是费话)必须精确匹配,访问控制要更公有化
Which modifiers and return types would be valid in the declaration of a
working main() method for a Java standalone application?
A) private
B) final
C) static
D) int
E) abstract
请选择: A B C D E
答案:B C
How can you change the break statement below so that it breaks out of both the
inner and middle loops and continues with the next iteration of the outer loop?
outer: for (int x = 0; x < 3; x++) {
middle: for (int y = 0; y < 3; y++) {
inner: for (int z = 0; z < 3; z++) {
if (arr(x, y, z) == targetValue)
break;
} } }
Select the one right answer.
a) break inner;
b) break middle;
c) break outer;
d) continue;
e) continue middle;
请选择: A B C D E
答案:B
Which are not Java keywords?
A. TRUE
B. sizeof
C. const
D. super
E. void
请选择: A B C D E
答案:A B
点评: A:不是,Java中有true,但是这也不是关键字而是字面量(literal)。
B:不是,Java中不需要这个操作符,所有的类型(原始类型)的大小都是固定的。
C、D、E都是,需要说明的是const是java中未被使用的关键字。
Given:
public abstract interface Frobnicate { public void twiddle(String s) ; }
Which is a correct class? (Choose all that apply.)
A. public abstract class Frob implements Frobnicate {
public abstract void twiddle(String s){}
}
B. public abstract class Frob implements Frobnicate { }
C. public class Frob extends Frobnicate {
public void twiddle(Integer i) { }
}
D. public class Frob implements Frobnicate {
public void twiddle(Integer i) { }
}
E. public class Frob implements Frobnicate {
public void twiddle(String i) { }
public void twiddle(Integer s) { }
}
请选择: A B C D E
答案:B E
Which of the following statements is correct for a method which is overriding the
following method:
public void add(int a) {…}
A. the overriding method must return void
B. the overriding method must return int
C. the overriding method can return whatever it likes
Select the most appropriate answer.
请选择: A B C
答案:A
Which are methods of the Object class? (Choose all that apply.)
A. notify();
B. notifyAll();
C. isInterrupted();
D. synchronized();
E. interrupt();
F. wait(long msecs);
G. sleep(long msecs);
请选择: A B C D E F G
答案:A B F
A socket object has been created and connected to a standard internet service on
a remote network server. Which construction give the most suitable means for
reading ASCII data online at a time from the socket?
A. InputStream in=s.getInputStream();
B. DataInputStream in=new DataInputstream(s.getInputStream());
C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream());
D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));
E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),”
8859-1”);
请选择: A B C D E
答案:E
点评:在程序中实现字节与字符转换时,采用规范“ISO8859-1”是最适宜的方式。
1) class Super{
2) public float getNum(){return 3.0f;}
3) }
4)
5) public class Sub extends Super{
6)
7) }
which method, placed at line 6, will cause a compiler error?
A. public float getNum(){return 4.0f;}
B. public void getNum(){}
C. public void getNum(double d){}
D. public double getNum(float d){return 4.0d;}
请选择: A B C D
答案:B
1) class Super{
2) public float getNum(){return 3.0f;}
3) }
4)
5) public class Sub extends Super{
6)
7) }
which method, placed at line 6, will cause a compiler error?
A. public float getNum(){return 4.0f;}
B. public void getNum(){}
C. public void getNum(double d){}
D. public double getNum(float d){return 4.0d;}
请选择: A B C D
答案:B
Which of the following statements are true?
A. For a given component events will be processed in the order the listeners are added.
B. Using the Adapter approach to event handling means there is a need to create blank
method bodies for all event methods.
C. A component may have multiple listeners associated with it.
D. Listeners may be removed once added.
请选择: A B C D
答案:C D
点评:没有
Give the following java class:
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
System.out.println(x[5]);
}
}
Which statement is corrected?
A. When compile, some error will occur.
B. When run, some error will occur.
C. Output is zero.
D. Output is null.
请选择: A B C D
答案:A
点评:自动变量不能被static修饰,如果将static关键字去掉,答案选择C。
Which collection class(es) allows you to grow or shrink its size
and provides indexed access to its elements, but whose methods are
not synchronized? (Choose all that apply.)
A. java.util.HashSet
B. java.util.LinkedHashSet
C. java.util.List
D. java.util.ArrayList
E. java.util.Vector
F. java.util.PriorityQueue
请选择: A B C D E F
答案:D
public static synchronized void main(String[] args) throws
InterruptedException {
Thread t = new Thread();
t.start () ;
System.out.print ("X") ;
t.wait (10000) ;
System.out.print("Y");
}
What is the result of this code?
A. It prints X and exits.
B. It prints X and never exits.
C. It prints XY and exits almost immeditately.
D. It prints XY with a 10-second delay between X and Y.
E. It prints XY with a 10000-second delay between X and Y.
F. The code does not compile.
G. An exception is thrown at runtime.
请选择: A B C D E F G
分享到:
相关推荐
Java 自测试题,适合java自学者的学习检测,也可作为招聘时的练习题
《Java测试题1》 Java培训后考试 一、 是非题5题(每题3分) 1、 对象的特征是对象有状态、行为、标识ID ( ) 2、 GenericServlet是一个与协议相关的Servlet类。 ( ) 3、 Java中的this指的是当前类...
适用于对学习J2SE考察用,题量适中。 该试题侧重于基本概念的掌握与应用
java初级语法测试题,
Java 技能测试题Java 技能测试题
java 测试题,包括四种大题,是非题,填空题,程序题,简答题。
最新北大青鸟 java测试题目
第3题 【单选题】【2.00分】【概念理解】 java中用于创建文件对象的类是 [单选题] * JAVA高级程序设计测试题含答案全文共43页,当前为第1页。 A. File(正确答案) B. Object C. Thread D. Frame E. 示例 第4题 【单选...
java测试题java测试题
Java测试题 用于检测学习效果的一个小测验!
杰普 Core Java测试题 附答案 答案是标准答案,有选择题也有编程题
广州传智播客JavaEE工程师测试题(带答案的).doc 应聘时最漂亮的回答.docx 当面试官问「你有什么要问我的吗」时,应该问什么?.docx 提高 Java 代码性能的各种技巧.docx 搜狗商业平台Java技术实践.docx 最新JAVA...
Java应用程序-题库测试题练习题带答案测试题模拟题自测题.doc
java期末测试题,是各种大学院校复习的资料
2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年...
包含数据结构绪论,线性表,树,图,查找,排序各章节自测题及详细答案,供在校计算机学生考试复习使用
北大青鸟S1java内部测试试卷(试题)
这是Java基础知识的一套判断题,在学习和复习Java的是时候可以用来进行模拟测试,检测一下自己的能力,用来备考。
北大青鸟S1 JAVA 选择题50题内部测试,规定时间一小时做完,大家可以自我测试一下。这个没有答案,我后来5月31日传的那个有答案。
javacore测试题及参考答案javacore测试题及参考答案