计算机二级习题练习

计算机二级考试Java每日一练(2016-1-14)
1题:若定义int a=2,b=2,下列表达式中值不为4的是(      )。 
A.a*(++b) 
B.a*(b++)
C.a+b 
D.a*b
【单选题】:      

2题:下面()不是InputStream类中的方法。
A.intread(byte[])
B.voidflush()
C.voidclose()
D.intavailable()
【单选题】:      

3题:下列特点中不属于Java的是(      )。 
A.多线程
B.多继承 
C.跨平台 
D.动态性
【单选题】:      

4题:SQL语言又称为()。
A.结构化定义语言
B.结构化控制语言
C.结构化查询语言
D.结构化操纵语言
【单选题】:      

5题:下面程序段的输出结果是(      )。 
class Test{
public s,tatic void main(String args[]){
MyThread t=new MyThread(); 
t.displayOutput("t has been createD"); 
t.start(); 
}
}
Class MyThread extends Thread{
public void displayOutput(String s){
System.out.println(s); 
}
public void run(){
displayOutput("t is running."); 
}
}
A.t has been created. 
B.t has been created. t is running.
C.t is running.
D.编译出错 
【单选题】:      

6题:下列程序的输出结果是(      )。 
Public class Test{
Public static void main(String[]args){
int[]array=(2,4,6,8,10); 
int size=6; 
int result=-l: 
try{
for(int i=0;iif(array[i]= =20)result=i: 
}
catch(ArithmeticException e){
System.out.println("Catch---1"); 
}
catch(ArraylndexOutOfBoundsException e){
System.out.println("Catch---2"): 
}
catch(Exception e){
System.out.println("Catch---3"): 
}
}
A.Catch---1 
B.Catch---2
C.Catch---3 
D.以上都不对
【单选题】:      

7题:下列程序的功能是在监控台上每隔一秒钟显示一个字符串”Hello!”,能够填写在程序中下画线位置,使程序完整并能正确运行的语句是( )。
  public class Test implements Runnable{
  public static void main(String args[]){
  Test t=new Test():
  Threadt t=new Thread(t);
  tt.start():
  }
  public void run(){
  for(;;){
  try{
  ;
  }catch(e){}
  System.out.println("Hello");
  }
  }
  }
  A.sleep(1000) B.t.sleep(1000)
  InterruptedExceptionInterruptedException
  C.Thread.sleep(1000)D.Thread.sleep(1000)
  RuntimeExceptionInterruptedException
【单选题】:      

8题:设某循环队列的容量为50,如果头指针front=45(指向队头元素的前一位置),尾指针rear=10(指向队尾元素),则该循环队列中共有元素个数为(      )。 
A.5 
B.15
C.35 
D.40
【单选题】:      

9题:耦合性和内聚性是对模块独立性度量的两个标准,下列叙述中正确的是(      )。 
A.提高耦合性降低内聚性有利于提高模块的独立性 
B.降低耦合性提高内聚性有利于提高模块的独立性 
C.耦合性是指一个模块内部各个元素间彼此结合的紧密程度 
D.内聚性是指模块闻互相连接的紧密程度
【单选题】:      

10题:下列程序段的输出结果是(      )。 
int data=0; 
char k=’a’,P=’f’; 
data=P-k: 
System.OUt.printll n(data); 
A.0 
B.a
C.f 
D.5
【单选题】:      

 

您正在结束答题

请确认是否提交试卷?

继续做题 确认提交