近期看了一些选择题(2)

36-40:D C CD C B
36.下面关于JAVA的优点说法错误的是?
A、JAVA是纯面向对象的语句,还有众多的API支持,所以JAVA开发各种各样的应用
程序变的非常容易且易于维护。
B、JAVA使用的是Unicode作为标准字符,这使得JAVA程序在不同的语言平台上都能
被编译和运行。
C、JAVA引进来的EXCEPTION处理机制,使得JAVA程序更安全、更稳定、更随机应变
D、垃圾回收机制是JAVA的内在特性,垃圾回收机制的调度是有程序员负责的

37.下面关于JVM说法不准确的是?
A、 JVM目前已有针对不同的平台开发了多个相应的版本。
B、所以的JAVA程序编译成字节码后都需要被调度到相应版本的JVM中才能执行。
C、各个版本的JVM对内存的管理都是通过GC机制实现的
D、JVM机制的引入才使我们的程序很容易的动态内存管理及多线程、JavaBean等服务。

38.下面关于JDK工具的说法不正确的?(复选题)
 A、我们可以通过JAVAC工具实现对JAVA程序的编译并能通过-d参数指定字节码文件
  的位置。
 B、-classpath无论对java及javac工具都有引进其它类的作用。
 C、javadoc工具可以把我们程序用所有注释部分自动生成html文档.
 D、appletview工具可以用来运行我们的applet小程序。

39.下面关于int在java程序中长度的说法精确的是?
 A、1 bytes
 B、2 bytes
 C、4 bytes
 D、8 bytes
40.下面代码中那一个不能够创建一个数组?
 A 、float []f[] = new float[6][6];
 B 、float f[][] = new float[][6];
 C、float [][]f = new float[6][6];
 D、float [][]f = new float[6][];

41-50:A B C C AD C C C BD ABD
41.给出如下声明?
String s1=new String(“Hello”);
String s2=new String(“there”);
String s3=new String();
下列选现中( )是合法的
 A、s3 = s1 + s2 B、s3 = s1 – s2 C、s3 = s1 & s2 D、s3 = s1 && s2

42.给出下面代码段:
boolean m = true;
if(m = false)
System.out.println(“False”);
else
System.out.println(“True”);运行的结果是? ( )
 A 、False B、True
 C、 None D、 An error will occur when running

43.下面的程序编译运行的结果是:
  public class Something {
  public static void main(String[] args) {
Other o = new Other();
new Something().addOne(o);
}
public void addOne(final Other o) {
   o.i++;
   }
  }
  class Other {
   public int i;
  }
A、编译时出错
B、运行时出错
C、正确运行

44.下面代码如何使成员变量m 被函数fun()直接访问?
class Test{
  private int m;
  public static void fun() {
    // some code̷
  }
}
A、将private int m 改为protected int m
B、将private int m 改为 public int m
C、将private int m 改为 static int m
D、将private int m 改为 int m4

45.面哪几个函数是public void example(){̷}的重载函数?(复选题)
public void example( int m){̷}
public int example(){̷}
public void example2(){̷}
public int example ( int m, float f){̷}

46.下面的代码段中,执行之后i 和j 的值是什么?
int i = 1;
int j;
j = i++;
A、1, 1
B、1, 2
C、2, 1
D、2, 2

47.已知如下的命令执行 java MyTest a b c请问哪个语句是正确的?
A、args[] = ̶MyTest a b c”
B、args[] = ̶MyTest”
C、args[] = ̶a”
D、args[1]= ‘b’

48.如下代码正确的结果是:
public class Test
{
long a[] = new long[1];
public static void main ( String arg[] ) {
System.out.println ( a[6] );
}
}
没有输出
输出
编译时出错
运行时出错

49.下面代码输出的结果是:(复选题)
public class Test
{
public static void main(String arg[])
{
int i = 5;
do {
System.out.println(i);
} while (–i>5)
System.out.println(̶finished”);
}
}
结果:
4
5
6
finished

50.在如下源代码文件Test.java中, 哪个是正确的类定义?(复选题)
public class test {
public int x = ;
public test(int x)
{
this.x = x;
}
}public class Test{
  public int x=;
  public Test(int x) {
  this.x = x;
  }
  }public class Test extends T1, T2 {
  public int x = ;
  public Test (int x) {
  this.x = x;
  }
  }public class Test extends T1{
  public int x=;
  public Test(int x){
  this.x = x;
  }
  }
  
51-60 :B B D B A BC B D D CD
51.class J_Test{
public static void main(String args[])
{
int i= 99;
mb_operate(i);
System.out.print(i+1);
} // End of method: main
static void mb_operate(int i)
{
i+=1;
} // End of method: mb_ operate
} // End of class: J_Test
上面程序的输出是什么? ( )
 A、 99 B、 199 C、 299 D、 991

52.下面代码运行的结果是:
  String s = new String(̶Bicycle”);
  int iBegin = 1;
  char iEnd = 3;
  System.out.println(s.substring(iBegin, iEnd));
 A、Bic
 B、ic
 C、icy
 D、error:no method matching substring(int,char)
  
53.class J_StringBuffer{
public static void main(String args[]){
StringBuffer a = new StringBuffer(̶A”);
StringBuffer b = new StringBuffer(̶B”);
mb_operate(a, b);
System.out.println(a + ̶.” + b);
} // End of method: mainstatic void mb_operate(StringBuffer x, StringBuffer y){
x.append(y);
y=x;
} // End of method: mb_operate
  } // End of class: J_StringBuffer
  上面程序的输出是什么?
 A、A.B
 B、A.A
 C、AB.AB
 D、AB.B

54.认真阅读下段例程,

  1. class Super{
  2. public float getNum(){return 3.f;}
  3. }
  4. public class Sub extends Super{
  5. }
    下面语句,哪句放在第6行会引起编译错误?
     A、public float getNum(){return 4.f;}
     B、public void getNum(){}
     C、public void getNum(double d){}
     D、public double getNum(float d){return 4.d;}

55.在Q2_2类哪个是合法的覆盖(override)?
public clsss Q2_1
{
public void method(int k){};
}
class Q2_2 extends Q2_1
{
}
A、public void method(int i){};
B、public void method(int j,int k){}
C、public float method(int k){};
D、private void method(int k){};

56.在Q2_2类中下面选项哪个没有形成合法的覆盖(override)? (复选题)
public class Q2_1
{
protected void method(int k ,char c){};
}
class Q2_2 extends Q2_1
{
}
A、public void method(int i,char c){}
B、public void method(char c, long n){}
C、public float method(int k,char c){return 3.2F;}
D、protected void method(int k,char c){}

57.下面的类中,哪个不是合法的重载(overload)?
public class Q1
{
public void method(int i){}
}
A、private void method(int i,int j){}
B、public void method(int k){}
C、private float method(float f){}
D、public String method(int i,int j){}
E、public float method(float f){}

58.看下面的代码,选择正确的结论:
class SuperClass
{
int i=8 ;
SuperClass()
{
add(1);
}
void add(int j)
{
i=i+j;
}
}
class SubClass extends SuperClass
{
  int i=8;
void add(int j)
{
i=i+2*j;
}
}
public class MainClass
{
public static void main(String args[])
{
SuperClass a=new SubClass();
System.out.println(a.i);
}
}
 A 、编译时出现错误 B、运行时出现错误
 C、输出 1 D、输出 8

59.阅读以下例程,
int i=1,j=1;
do{
if(i++>–j) continue;
}while(i<5);
此段程序执行后,i和j的值是:
 A、 i=6 j=5
 B、 i=5 j=5
 C、 i=6 j=4
 D、 i=5 j=6
 E、 i=6 j=6

60.对垃圾回收机制叙述正确的是:(复选题)
 A、垃圾回收总是在程序结束时由虚拟机启动
 B、一个对象在没有reference时会立即被回收
 C、垃圾回收时机是没有保证的
 D、程序员不能主动唤起垃圾回收
61-68:A B B F G B C D
61.以下语句中有语法错误的是:
 A、 for(;;?;
 B、 for (int i=;i<1;i++){};
 C、 if (a<) a++;
 D、 ; ; ;62.选择程序的标准输出结果
public class WhatIsX
{
public static void f(StringBuffer x)
{
x=x.append(x);
}
public static void main(String[] args)
{
StringBuffer x=new StringBuffer(̶1″);
f(x);
System.out.println(x);
}
}
A、1
  B、11
  C、2
  D、63.请问下面程序代码中,最后的a,b变量所存放的数值是什么?
int x,a=5,b=3;
x=a+++b–
A、x=8,a=5,b=3
B、x=8,a=6,b=2
C、x=7,a=5,b=2
D、x=9,a=6,b=364.下面程序代码运行完毕后,变量值会多少?
class A
{
public static void main(String args[])
{
int x=5;
switch(x)
{
case 5: x++;
System.out.println(x);
case 2+4:
System.out.println(x);
default:
x+=2;
System.out.println(x);
}
}
 A、5
 B、6
 C、7
 D、5,6
 E、6,7
 F、6,6

65.public class Test{
public static void main(String[] args){
String foo=args[1];
String bar=args[2];
String baz=args[3];
}
  }
java Test Red Green Blue
baz的值是多少?
A、baz has value of ̶”
B、baz has value of null
C、baz has value of ̶Red”
D、baz has value of ̶Blue”
E、baz has value of ̶Green”
F、the code does not compile 
G、the program throw an exception66. int index=1;
int foo[]=new int[3];
int bar=foo[index];
int baz=bar+index;结果是多少?
A、baz has a value of
B、baz has value of 1
C、baz has value of 2
D、an exception is thrown
E、the code will not compile

67.定义一个类名为“MyClass”的类,并且该类可被一个工程中的所有类访问,那么该类的正确声明应为:
  A、private class MyClass extends Object
  B、class MyClass extends Object
  C、public class MyClass
  D、private class MyClass extends Object68.下面的哪段代码将不会出现编译错误?
A、int i = ;
if(i){
System.out.println(̶Hi”);
}
B、String a = ̶1″;
boolean b = true;
if( a = = b)
{
System.out.println(” so true”);
}
C、int i = 1;
int j = 2;
if(i = = 1 &| j = =2 )
System.out.println(̶ok”);}
D、int i = 1;
int j = 2;
if(i = = 1|| j = =2 )
System.out.println(̶ok”);}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值