资格证大类 - 计算机编程
关于红黑树和AVL树,以下哪种说法不正确()。
A、两者都属于自平衡二叉树
B、两者查找,插入,删除的时间复杂度相同
C、包含n个内部节点的红黑树的高度是O(log(n))
D、JDK的TreeMap是一个AVL的实现
已知: 下面哪些代码是对构造函数的重载()
AC(){}
Bpublic Object C(byteb){}
Cpublic void C(){}
Dprivate C(inti,intj){}
现有: class Test2 f public static void main (String [] args) { short a,b,C; a=l; b=2; C=a+b; a+=2: } 以上代码中,哪一句是错误的?()
A、a=1:
B、C=a+b;
C、a+=2;
D、short a,b,C;
下述代码执行后,有几个引用变量和几个对象?() Student stu = new Student(“Mike”); Student stua; Stua = stu;
A、 2个引用变量,1个对象
B、 1个引用变量,1个对象
C、 2个引用变量,2个对象
D、 1个引用变量,2个对象
class TestApp{ public static void main(String[] args){ System.out.println(multiply(2,3,4,5)); } public int multiply(int… nums){ int result = 1; for(int x :nums) result *= x; //result =result*x; return result; } } 2、6、24、120 程序运行后的输出是哪项?()
A、 14
B、 编译错误
C、 120
D、 24
现有: class Waiting implements Runnable { boolean flag=false; public synchronized void run() { if (flag) { flag=false; System.out.print ("1"); try { this.wait(); ) catch (Exception e) { } System.out.print ("2"); } else { flag=true; System.out.print ("3"); try{Thread.sleep (2000); } catch(Exception e) {} System.out.print ("4"); notify(); } } public static void main (String [] args) { Waiting w=new Waiting(); new Thread (w) .start(); new Thread (w) .start(); } } 以下哪两项是正确的?()
A代码输出l 3 4
B代码输出3 4 1
C代码输出l 2 3 4
D代码输出1 3 4 2
E代码运行完毕
F代码不会完成
以下哪个类与Swing GUI菜单类无关?()
A、JMenu
B、JMenuBar
C、JMenuItem
D、以上皆是
组件的getBounds()方法返回值的类型是哪项?()
A、 Dimension
B、 Rectangle
C、 Point
D、 int[]
已知:下面哪些语句在横线处可以正常编译()
A、inti=a.length();
B、inti=a[10];
C、inti=a.getAt(0);
D、inti=a[a[0]];
public classYippee{ public static void main(String[]args){ for(intx=1;xSystem.out.print(args[x]+""); } } } and two separate command line invocations:j avaYippee javaYippee1234 What is the result?()
A、No output is produced. 123
B、No output is produced. 234
C、No output is produced. 1234
D、An exception is thrown at runtime. 123
E、An exception is thrown at runtime. 234
F、An exception is thrown at runtime. 1234