我所遇到的部分选择测试题

 

运行jsp需要安装_Web服务器。(选两项)

A、Apache

B.Tomcat

c、webLogic

D、IIS

答案:BC

 

已知A类被打包在packageA, B类被打包在packageB,且B类被声明为public,且有一个成员变量x被声明为, protected控制方式。C类也位于packageA包,且继承了B类。则以下说话正确的是

A、A关的实例不能访问到B关的实例

B、A类的实例能够访问到B类个实例的x成员

C、C类的实例可以访问到B类—个实例的x成员

D、C类的实例不能访问到B类的实例

答案:C

 

与HttpSessionListener接口有关的方法是。

  1. sessionInitalized()
  2. sessionCreated()
  3. sessionFinialized()
  4. sessionDestroyed()

答案:BD

 

下列哪些语句关于内存回收的说明是正确的

A、程序员必须创建一个线程来释放内存

B、内存回收程序负责释放无用内存

C、内存回收程序允许程序员直接释放内存

D、内存回收程序可以在指定的时间释放内存对象

答案:B

 

方法resume()负责恢复哪些线程的执行()

A、A通过调用stop(方法而停止的线程。

B、B通过调用sleep0方法而停止的线程。

c、C通过调用wait()方法而停止的线程。

D、D通过调用suspend(方法而停止的线程。

答案:D

 

执行完以下代码int [ ]x = new int[25];后,以下哪项说明是正确的( ) :

A、x24]为0

B、x[24]未定义

C、x[25]为0

D、x[0]为空

答案:A

 

关于线程设计,下列描述正确的是

A、线程对象必须实现Runnable接口

B、启动—个线程直接调用线程对象的run()方法

c. Java提供对多线程同步提供语言级的支持

D、一个线程可以包含多个进程

答案:C

 

关于javlang.String类,以下描述正确的一项是

A、string类是final类故不可以继承;

B、String类是final类故可以继承;

C、string类不是final类故不可以继承;

D、String类不是final类故可以继承;

答案:A

 

下面哪个是正确的?()

A、string temp= new string {"a""b”"℃""l;

B、string temp= [a""b"C"

c. String temp = {a", "b",“℃}

D.string temp[]= {"a", ""b"","C"}

 

答案D

 

 

Java l/O程序设计中,下列描述正确的是

A、 Outputstream用于写操作

B、Inputstream用于写操作

c、IIO库不支持对文件可读可写API

答案 A

 

 

public class Test {

public static void main (String argsD) {class Foo {

public int i = 3;}

Object o = (Object) new Foo();Foo foo = (Foo)o;

System.out.printIn(foo.i);

)

what is the result?

A compilation will fail.

B Compilation will succeed and the program will print "3

C Compilation will succeed but the program will throw a ClassCastException at line 6.

D Compilation will succeed but the program will throw a ClassCastException at line 7.

答案B

 

什么是Web Service(Web服务)?

从表面上看,Web Service就是一个应用程序,它向外界暴露出一个能够通过Web进行调用的API。这就是说,你能够用编程的方法透明的调用这个应用程序,不需要了解它的任何细节,跟你使用的编程语言也没有关系。例如可以创建一个提供天气预报的Web Service,那么无论你用哪种编程语言开发的应用都可以通过调用它的API并传入城市信息来获得该城市的天气预报。之所以称之为Web Service,是因为它基于HTTP协议传输数据,这使得运行在不同机器上的不同应用无须借助附加的、专门的第三方软件或硬件,就可以相互交换数据或集成。

.public class × implements Runnable {

private int x;

private int y;

 public static void main(String []args) {X that = new X();

 public synchronized void run( )10.for (;;) {

x++;12.y++;

System.out. printin("x = “+x + ",y=“+ y);}}}

  1. An error at line 11 causes compilation to fail.

 

B. Errors at lines 7 and 8 cause compilation to fail.

 

C.The program prints pairs of values for x and y that might not always be the same on the same line (for example,“x=2,y=1")

 

  1. The program prints pairs of values for x and y that are always the same on the same line (for example, "x=1, y=1". ln addition, each value appears twice (for example,"x=1, y=1" followed by"x=2,y=2")

答案D

 

欲构造ArrayList类得一个实例,此类继承了List接口,下列哪个方法是正确的:

A、ArrayList myList = new Object();

B、List myList = new ArrayList();

c.ArrayIList myList = new ListO;

D、List myList = new List();

答案  B

 

在服务器的网络编程中,解决会话跟踪的方法有:

A、使用Cookie。

B、使用URL重写。

C、使用隐藏的表单域。

D、以上方法都不能单独使用。

答案:ABC

 

JSP生命周期脏的叙述,下列哪些为真?

A、JSP会先解释成Servlet源文件,然后编译成Servlet类文件

B、每当用户端运行JSP时,jsplnit()方法都会运行—次

C、每当用户端运行JSP时,_jspService()方法都会运行一次

D、每当用户端运行JSP时,jspDestroy()方法都会运行—次

答案AC

 

 

20、What will be the output when you compile and execute the following program.

class Base

{

void test() {

System.out.printIn("Base.test()");}

}

public class Child extends Base {void test() {

System.out. println("Chiltest()");}

static public void main(Stringl a) {Child anObj = new Child();

Base baseObj =(Base)anObj;baseObj.test();

}

Select most appropriate answer.

A.Chiltest()

B、Base.test()

c. Base.test()

D、Chiltest()

 

答案D

 

以下哪个方法用于定义线程的执行体?

A. start()

B、init()

c、run)

D、main()

E、synchronizedp

答案C

 

栈是—种

A、存取受限的线性结构

B、存取不受限的线性结构

c、存取受限的非线性结构

D、存取不受限的非线性结构

答案A

  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

池鱼i_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值