java程序员认证考试试题
Java具有简单性、面向对象、分布式、健壮性、安全性、平台的独立与可移植性、多线程、动态性等特点。下面是小编整理的关于java程序员认证考试试题,欢迎大家参考!
h statement about the garbage collection mechanism are true?
A. Garbage collection require additional programe code in cases where multiple threads are running.
B. The programmer can indicate that a reference through a local variable is no longer of interest.
C. The programmer has a mechanism that explicity and immediately frees the memory used by Java objects.
D. The garbage collection mechanism can free the memory used by Java Object at explection time.
E. The garbage collection system never reclaims memory from objects while are still accessible to running user threads.
2. Give the following method:
1) public void method( ){
2) String a,b;
3) a=new String(“hello world”);
4) b=new String(“game over”);
5) tln(a+b+”ok”);
6) a=null;
7) a=b;
8) tln(a);
9) }
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.
A. before line 3
re line 5
C. before line 6
re line 7
E. Before line 9
3. In the class vent,which is the parent class upon which jdk1.1 awt events are based there is a method called getID which phrase accurately describes the return value of this method?
A. It is a reference to the object directly affected by the cause of the event.
B. It is an indication of the nature of the cause of the event.
C. It is an indication of the position of the mouse when it caused the event.
D. In the case of a mouse click, it is an indication of the text under the mouse at the time of the event.
E. It tells the state of certain keys on the keybord at the time of the event.
F. It is an indication of the time at which the event occurred.
4. Which statement about listener is true?
A. Most component allow multiple listeners to be added.
B. If multiple listener be add to a single component, the event only affected one listener.
C. Component don?t allow multiple listeners to be add.
D. The listener mechanism allows you to call an addXxxxListener method as many times as is needed, specifying as many different listeners as your design require.
the following code:
public class Example{
public static void main(String args[] ){
int l=0;
do{
tln(“Doing it for l is:”+l);
}while(--l>0)
tln(“Finish”);
}
}
Which well be output:
A. Doing it for l is 3
B. Doing it for l is 1
C. Doing it for l is 2
D. Doing it for l is 0
E. Doing it for l is ?C1
F. Finish
6. Give the code fragment:
1) switch(x){
2) case 1:tln(“Test 1”);break;
3) case 2:
4) case 3:tln(“Test 2”);break;
5) default:tln(“end”);
6) }
which value of x would cause “Test 2” to the output:
A. 1
B. 2
C. 3
D. default
7. Give incompleted method:
1)
2) { if(unsafe()){//do something…}
3) else if(safe()){//do the other…}
4) }
The method unsafe() well throe an IOException, which completes the method of declaration when added at line one?
A. public IOException methodName()
B. public void methodName()
C. public void methodName() throw IOException
D. public void methodName() throws IOException
E. public void methodName() throws Exception
8. Give the code fragment:
if(x>4){
tln(“Test 1”);}
else if (x>9){
tln(“Test 2”);}
else {
tln(“Test 3”);}
Which range of value x would produce of output “Test 2”?
A. x<4
B. x>4
C. x>9
D. None
9. Give the following method:
public void example(){
try{
unsafe();
tln(“Test1”);
}catch(SafeException e){tln(“Test 2”);
}finally{tln(“Test 3”);}
tln(“Test 4”);
Which will display if method unsafe () run normally?
A. Test 1
B. Test 2
C. Test 3
D. Test 4
10. Which method you define as the starting point of new thread in a class from which new the thread can be excution?
A. public void start()
B. public void run()
C. public void int()
D. public static void main(String args[])
E. public void runnable()
n the following class definition:
class A{
protected int i;
A(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this class?
Select all valid answers:
A. class B{
}
B. class B extends A{
}
C. class B extends A{
B(){tln(“i=”+i);}
}
D. class B{
class A{}
}
E. class A{}
12. Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body?
A. synchronized
B. abstract
C. final
D. static
E. public
13. The following code is entire contents of a file called ,causes precisely one error during compilation:
1) class SubClass extends BaseClass{
2) }
3) class BaseClass(){
4) String str;
5) public BaseClass(){
6) tln(“ok”);}
7) public BaseClass(String s){
8) str=s;}}
9) public class Example{
10) public void method(){
11) SubClass s=new SubClass(“hello”);
12) BaseClass b=new BaseClass(“world”);
13) }
14) }
Which line would be cause the error?
A. 9 B. 10 C. 11 D.12
14. Which statement is correctly declare a variable a which is suitable for refering to an array of 50 string empty object?
A. String [] a
B. String a[]
C. char a[][]
D. String a[50]
F. Object a[50]
15. Give the following java source fragement:
//point x
public class Interesting{
//do something
}
Which statement is correctly Java syntax at point x?
A. import .*;
age mypackage
C. static int PI=3.14
D. public class MyClass{//do other thing…} E. class MyClass{//do something…}
16. Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of ?
A. Change private int x to public int x
B. change private int x to static int x
C. Change private int x to protected int x
D. change private int x to final int x
17. the piece of preliminary analsis work describes a class that will be used frequently in many unrelated parts of a project
“The polygon object is a drawable, A polygon has vertex information stored in a vector, a color, length and width.”
Which Data type would be used?
A. Vector
B. int
C. String
D. Color
E. Date
18. A class design requires that a member variable should be accessible only by same package, which modifer word should be used?
A. protected
B. public
C. no modifer
D. private
h declares for native method in a java class corrected?
A. public native void method(){}
B. public native void method();
C. public native method();
D. public void method(){native;}
E. public void native method();
20. Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?
21. Which is the main() method return of a application?
A. String
B. byte
C. char
D. void
22. Which is corrected argument of main() method of application?
A. String args
B. String ar[]
C. Char args[][]
D. StringBuffer arg[]
23. “The Employee object is a person, An Employee has appointment store in a vector, a hire date and a number of dependent”
short answer: use shortest statement declare a class of Employee.
24. Give the following class defination inseparate source files:
public class Example{
public Example(){//do something}
protected Example(int i){//do something}
protected void method(){//do something}
}
public class Hello extends Example{//member method and member variable}
Which methods are corrected added to the class Hello?
A. public void Example(){}
B. public void method(){}
C. protected void method(){}
D. private void method(){}
25. Float s=new Float(0.9F);
Float t=new Float(0.9F);
Double u=new Double(0.9);
Which expression?s result is true?
A. s==t
B. ls(t)
C. s==u
D. ls(u)
26. Give following class:
class AClass{
private long val;
public AClass(long v){val=v;}
public static void main(String args[]){
AClass x=new AClass(10L);
AClass y=new AClass(10L);
AClass z=y;
long a=10L;
int b=10;
}
}
Which expression result is true?
A. a==b;
B. a==x;
C. y==z;
D. x==y;
E. a==10.0;
-
2017年计算机等级程序设计上机操作题
c语言程序设计可以作为系统设计语言,编写工作系统应用程序,也可以作为应用程序设计语言,编写不依赖计算机硬件的应用程序。因此,它的应用范围广泛。下面是关于计算机等级程序设计上机操作题,欢迎大家参考!一、编程题请编写函数fun,其功能是:判断t所指字符串中的字母是...
-
2017年关于msoffice一级考试题及答案
《计算机应用》月刊,于1981年创刊,由中国科学院成都计算机应用研究所主办,是国内较早公开发行的计算机技术刊物,在计算机自动化领域有较大影响。下面是小编整理的关于msoffice一级考试题及答案,欢迎大家参考!一、选择题1).486微机的字长是A.8位B.16位C.32位D.64位正...
-
嵌入式Linux开发工程师基本知识汇总
嵌入式Linux凭借其系统发展的成熟度、市场应用的高份额也受到更多工程师朋友的青睐,越来越多的企业和研发机构都转向嵌入式Linux的开发和研究,这使得嵌入式Linux在新兴的嵌入式操作系统领域内也获得了飞速发展和广泛应用。面对如此火热的行业,如何才能成为嵌入式L...
-
2017年全国计算机等级考试开考科目及介绍
2017年全国计算机等级考试继续实行NCRE2013版考试大纲和新的证书认证体系,实施NCRE全部级别和科目的无纸化考试工作。下面是小编整理的关于计算机等级考试科目,希望可以帮助大家!级别考试科目考试教材考试时间一级计算机基础及WPSOffice应用计算机基础及WPSOffic...