JAVA系统分析笔试题

时间:2020-12-09 20:46:34 笔试经验 我要投稿

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?

  A.just after line 5.

  B.just after line 6

  C.just after line 7(that is,as the method returns)

  D.never 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 Example.java,causes precisely one error during compilation:

  class SubClass extends BaseClass{

  }

  class BaseClass(){

  String str;

  public BaseClass(){

  System.out.println(“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 Example.java,causes precisely one error during compilation:

  class SubClass extends BaseClass{

  }

  class BaseClass(){

  String str;

  public BaseClass(){

  System.out.println(“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) System.out.println("Some things are true in this world");

  else System.out.println("Nothing is true in this world!");

  else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false");

  else System.out.println("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) System.out.println("Some things are true in this world");

  else System.out.println("Nothing is true in this world!");

  else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false");

  else System.out.println("Hey this won't compile");

  Choices:

  A.The code won't compile

  B."Some things are true in this world" will be printed

  C."Hey this won't compile" will be printed

  D.None 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?

  A.public class MyClass{//do other thing…}

  B.static int PI=3.14

  C.class MyClass{//do something…}

  D.none

  6:public class Parent {

  int change() {…}

  }

  class Child extends Parent {

  }

  Which methods can be added into class Child?

  A.public int change(){}

  B.abstract int chang(){}

  C.private int change(){}

  D.none

  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:System.out.println(4|7);

  Select the right answer:

  A.4

  B.5

  C.6

  D.7

  9:Which fragments are not correct in Java source file?

  A.package testpackage; public class Test{//do something...}

  B.import java.io.*; package testpackage; public class Test{// do something...}

  C.import java.io.*; class Person{// do something...} public class Test{// do something...}

  D.import java.io.*; import java.awt.*; 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[]){

  System.out.println(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[]){

  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.

  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?

  A.public void start()

  B.public void run()

  C.public void runnable()

  D.public static void main(String args[])

  13:Which statements about Java code security are not true?

  A.The bytecode verifier loads all classes needed for the execution of a program.

  B.Executing code is performed by the runtime interpreter.

  C.At runtime the bytecodes are loaded, checked and run in an interpreter.

  D.The 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];

  System.out.println(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];

  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.

  16:Select valid identifier of Java:

  Select valid identifier of Java:

  A.%passwd

  B.3d_game

  C.$charge

  D.this

  简答题

  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

  …
 

JAVA系统分析笔试题

【JAVA系统分析笔试题】相关文章:

精选Java笔试题12-20

Java经典笔试题12-15

java试题及答案08-12

360笔试题目07-11

华为2017笔试题08-16

java基础笔试题201710-15

Java基础笔试题大全10-15

华为的Java笔试题07-31

Java招聘笔试题目03-03

高级Java笔试题集合02-10