JAVA系统分析笔试题
选择题
1:public class X{
public Object m(){
Object o = new Float(3.14F);//line 3
Object [] oa = new Object[1];//line 4
oa[0] = o;//line 5
o=null;//line 6
return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
public class X{
public Object m(){
Object o = new Float(3.14F);//line 3
Object [] oa = new Object[1];//line 4
oa[0] = o;//line 5
o=null;//line 6
return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
after line 5.
after line 6
after line 7(that is,as the method returns)
r in this method
2: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 0000 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
3:The following code is entire contents of a file called ,causes precisely one error during compilation:
class SubClass extends BaseClass{
}
class BaseClass(){
String str;
public BaseClass(){
tln(“ok”);}
public BaseClass(String s){
str=s;}}
public class Example{
public void method(){
SubClass s=new SubClass(“hello”);
BaseClass b=new BaseClass(“world”);
}
}
Which line would be cause the error?
The following code is entire contents of a file called ,causes precisely one error during compilation:
class SubClass extends BaseClass{
}
class BaseClass(){
String str;
public BaseClass(){
tln(“ok”);}
public BaseClass(String s){
str=s;}}
public class Example{
public void method(){
SubClass s=new SubClass(“hello”);
BaseClass b=new BaseClass(“world”);
}
}
Which line would be cause the error?
A.9
B.10
C.11
D.12
4:What will be the result of executing the following code?
boolean a = true;
boolean b = false;
boolean c = true;
if (a == true)
if (b == true)
if (c == true) tln("Some things are true in this world");
else tln("Nothing is true in this world!");
else if (a && (b = c)) tln("It's too confusing to tell what is true and what is false");
else tln("Hey this won't compile");
Choices:
What will be the result of executing the following code?
boolean a = true;
boolean b = false;
boolean c = true;
if (a == true)
if (b == true)
if (c == true) tln("Some things are true in this world");
else tln("Nothing is true in this world!");
else if (a && (b = c)) tln("It's too confusing to tell what is true and what is false");
else tln("Hey this won't compile");
Choices:
code won't compile
B."Some things are true in this world" will be printed
C."Hey this won't compile" will be printed
of these
5:Give the following Java source fragement:
//point x
public class Interesting{
//do something
}
Which statement is correctly Java syntax at point x?
Give the following java source fragement:
//point x
public class Interesting{
//do something
}
Which statement is correctly Java syntax at point x?
ic class MyClass{//do other thing…}
ic int PI=3.14
s MyClass{//do something…}
6:public class Parent {
int change() {…}
}
class Child extends Parent {
}
Which methods can be added into class Child?
ic int change(){}
ract int chang(){}
ate int change(){}
7:给出下面的代码片断。。。下面的哪些陈述为错误的?
1) public void create() {
2) Vector myVect;
3) myVect = new Vector();
4) }
给出下面的代码片断。。。下面的哪些陈述为错误的?
1) public void create() {
2) Vector myVect;
3) myVect = new Vector();
4) }
A.第二行的声明不会为变量myVect分配内存空间。
B.第二行语句创建一个Vector类对象。
C.第三行语句创建一个Vector类对象。
D.第三行语句为一个Vector类对象分配内存空间
8:What is written to the standard output given the following statement:tln(4|7);
Select the right answer:
A.4
B.5
C.6
D.7
9:Which fragments are not correct in Java source file?
age testpackage; public class Test{//do something...}
rt .*; package testpackage; public class Test{// do something...}
rt .*; class Person{// do something...} public class Test{// do something...}
rt .*; import .*; public class Test{// do something...}
10:Give the following java class:
public class Example{
static int x[]=new int[15];
public static void main(String args[]){
tln(x[5]);
}
}
Which statement is corrected?
Give the following java class:
public class Example{
static int x[]=new int[15];
public static void main(String args[]){
tln(x[5]);
}
}
Which statement is corrected?
compile, some error will occur.
run, some error will occur.
ut is zero.
ut is null.
11:使用 JDBC 可以做到的是
A.把二进制代码传送到任何关系数据库中
B.把 Java 源代码传送到任何关系数据库中
C.把表单信息传送到任何关系数据库中
D.很容易地把 SQL 语句传送到任何关系数据库中
12:Which method you define as the starting point of new thread in a class from which new the thread can be excution?
ic void start()
ic void run()
ic void runnable()
ic static void main(String args[])
13:Which statements about Java code security are not true?
bytecode verifier loads all classes needed for the execution of a program.
uting code is performed by the runtime interpreter.
runtime the bytecodes are loaded, checked and run in an interpreter.
class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.
14:关于垃圾收集的哪些叙述是对的。
A.程序开发者必须自己创建一个线程进行内存释放的.工作。
B.垃圾收集将检查并释放不再使用的内存。
C.垃圾收集允许程序开发者明确指定并立即释放该内存。
D.垃圾收集能够在期望的时间释放被java对象使用的内存。
15:Give the following java class:
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
tln(x[5]);
}
}
Which statement is corrected?
Give the following java class:
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
tln(x[5]);
}
}
Which statement is corrected?
compile, some error will occur.
run, some error will occur.
ut is zero.
ut is null.
16:Select valid identifier of Java:
Select valid identifier of Java:
A.%passwd
B.3d_game
C.$charge
简答题
17:abstract class和interface有什么区别?
18:hibernate中,什么情况下,对象的状态可以由持久的变为托管的?
19:两个数相乘,小数点后位数没有限制,请写一个高精度算法。
20:求符合指定规则的数。
给定函数d(n) = n n的各位之和,n为正整数,如 d(78) = 78 7 8=93。 这样这个函数
可以看成一个生成器,如93可以看成由78生成。
定义数A:数A找不到一个数B可以由d(B)=A,即A不能由其他数生成。现在要写程序,找出
1至10000里的所有符合数A定义的数。
输出:
1
3
…
-
2017考研现场确认时间
考研现场确认是考研报名的一个重要环节,下面是小编搜集整理的2017年考研现场确认时间,欢迎阅读查看。2017考研现场确认时间2016年11月4日至11月12日确认地点不同身份的考生报考点不同(1)推荐免试生根据毕业院校按所在地省级教育招生考试管理机构要求办理网上报名...
-
南京财经大学2015年考研复试通知发布
近日,南京财经大学研究生院发布《南京财经大学2015年报考攻读硕士学位研究生复试通知》,从中获悉南京财经大学2015年考研复试相关信息。2015年硕士研究生复试定于3月30日-4月1日进行,请务必于2015年3月30日15:00前到我校办理报到手续并参加复试,报到时间及地点见复...
-
2015考研国家线分析预测
教育部依据硕士生培养目标,结合年度招生计划、生源情况及总体初试成绩情况,确定报考统考、MBA及法律硕士专业学位考生进入复试的基本要求标准,其中包括应试科目总分要求和单科分数要求;对应届本科毕业生和非应届毕业生实行统一的进入复试基本分数要求。考研国家线...
-
2017年安徽中医药大学考研临床医学综合能力(中医)考研大纲
随着考研的到来,考研大纲也开始出台了。下面是小编为大家整理收集的关于2017年安徽中医药大学考研临床医学综合能力(中医)考研大纲的相关内容,仅供大家参考。Ⅰ考试性质临床医学综合能力(中医)是为医学高等院校及科研院所招收中医临床医学专业学位硕士研究生而设...