JAVA工程师学习的试题.docxVIP

  • 45
  • 0
  • 约3.29千字
  • 约 8页
  • 2021-01-02 发布于山东
  • 举报
JAVA 工程师试题 选择题: 1. 以下是关于 HttpServlet 类中 doGet()、doPost()、doDelete()、doPut()、service()方法的描述。 a) b) c)HttpServlet 中没有 doDelete()这个方法。 doGet()、doPost()、service()这些方法都不是线程安全的。 客户端来的 get 请求将调用 doGet(),客户端来的 post 请求将调用 doPost() 方法。客户端来的所有请求都调用 service()方法。 d)以上说法都不对。 2.在服务器的网络编程中,解决会话跟踪的方法有: a) b) c) d)使用 Cookie。 使用 URL重写。 使用隐藏的表单域。以上 方法都不能单独使用。 3.在以下哪些情况下 session会话将结束生命周期 a) 1 / 8 b) c) d)客户端关闭浏览器。 会话过期。 服务器调用了 HttpSession的 invalidate()方法。 客户端没有访问本应用而连接到别的应用上。 4.Whichstatementis true? a)A trystatementmusthaveat leastone corresponding catchblock. b)Multiplecatch statementscan catch thesameclass of exceptionmore thanonce. c)An Error that might be thrown in a method must be declared as thrown by that method, or be handled withinthatmethod. d)Except in case of VM shutdown,if a try block starts to execute,a corresponding finally block willalwaysstartto execute. e)Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block must alwaysrunto completion. 5.Whatwillhappen when you attemptto compileand runthefollowingcode? publicclassStatic{ static{ intx=5;// 在 static 内有效 } 2 / 8 staticintx,y; x--;//-1// 初始化为 0 publicstaticvoid main(Stringargs[]){ myMethod(); System.out.println(x+ y + ++x); } publicstaticvoid myMethod(){ y =x+++++x;//y=-1+1 x=1 } } a)compiletimeerror b)prints:1 c)prints:2 d)prints:3 e)prints:7 f)prints:8 6. 由 a.jsp 传递一个参数: ”我是竹子 ”到为 gb2312 会出现何种情况 _____? a) b) c)  b.jsp。a.jsp 编码为 UTF-8,b.jsp 编码 3 / 8 d)正常传递,无任何异常情况。 无法传递中文信息。报错。 可以传递。但 b.jsp 接到的参数为乱码。 编译不通过,提示非法参数或语法错误。 7.以下是用户请求访问 Servlet 的过程的描术,哪些是错误的: a) b) c) d)servlet 容器将创建一个 ServletRequest对象和 ServletResponse对象。 在 ServletResponse对象中封装了用户请求信息,然后 ServletServletResponse对象和 ServletRequest对象传给用户所请求的 Servlet。 Servlet 把响应结果写到 ServletRequest中,然后由 Servlet 容器把响应结果传给用户。 以上都没错。 8.选出对于 XML 的评论正确的选项___ a) b)XML 是一种语言无关平台无关的自描述语言。 标签实际上包含了元素和属性两部分。用元素来描述有规律的数据,用属性来描述系统数据。 c)XML 不可跨平台,不具备扩展性。 d)XML 文档中的每一个元素都处在一个名字空间中;如果没有指定的名字空间,缺省的名字空间就是和该元素相关联的名字空间。 4 / 8 9.O/R 可以实现 ____ a) b) c) d)

文档评论(0)

1亿VIP精品文档

相关文档