东软IT人才培训专用考试试卷_第1页
东软IT人才培训专用考试试卷_第2页
东软IT人才培训专用考试试卷_第3页
东软IT人才培训专用考试试卷_第4页
东软IT人才培训专用考试试卷_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 1 页 共 13 页 姓名 姓名 学校 学校 班级 班级 满分 满分 时间 时间 90 分钟分钟 一 单项选择题 1 下列程序片段的运行结果是 1 public class test 2 private static int j 0 3 4 private static boolean methodB int k 5 j k 6 return true 7 8 9 public static void methodA int i 10 boolean b 11 b i 10 methodB 4 12 b i 10 methodB 8 13 14 15 public static void main String args 16 methodA 0 17 System out println j 18 19 A 输出 0 B 输出 4 C 输出 8 D 输出 12 E 代码不完整 2 以下代码的运行结果是 1 public class test 2 public static void add3 Integer i 3 int val i intValue 4 val 3 5 i new Integer val 6 7 8 public static void main String args 9 Integer i new Integer 0 10 add3 i 11 System out println i intValue 12 13 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 2 页 共 13 页 A 编译失败 B 打印 0 C 打印 3 D 编译成功 但在第 3 行抛出一个异常 3 以下选项中 哪两个重载了 ConstOver 的构造方法 ConstOver 如下 1 public class ConstOver 2 public ConstOver int x int y int z 3 4 A ConstOver B protected int ConstOver C private ConstOver int z int y byte x D public ConstOver int z int y int x E public void ConstOver byte x byte y byte z 4 以下代码的运行结果是 int index 1 int foo new int 3 int bar foo index int baz bar index A baz 的值为 0 B baz 的值为 1 C baz 的值为 2 D 程序抛出异常 E 程序无法编译 5 如果想使任何包中的子类都可以访问父类中的成员 下列选项中哪一项是最严格的访问修饰符 A public B private C protected D transient E 没有一个访问修饰符是正确的 6 以下代码的运行结果是 1 abstract class AbstractIt 2 abstract float getFloat 3 4 public class AbstractTest extends AbstractIt 5 private float f1 1 0f 6 private float getFloat return f1 7 A 编译成功 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 3 页 共 13 页 B 第 6 行产生错误 导致运行失败 C 第 6 行产生错误 导致编译失败 D 第 7 行产生错误 导致编译失败 7 以下代码的运行结果是 1 public class Test 2 public int aMethod 3 static int i 0 4 i 5 return i 6 7 public static void main String args 8 Test test new Test 9 test aMethod 10 int j test aMethod 11 System out println j 12 13 A 编译失败 B 编译成功 并且程序打印 0 C 编译成功 并且程序打印 1 D 编译成功 并且程序打印 2 8 在以下代码的第 6 行中 加入下列哪一项的方法后 将引起一个编译错误 1 class Super 2 public float getNum return 3 0f 3 4 5 public class Sub extends Super 6 7 A public float getNum return 4 0f B public void getNum C public void getNum double d D public double getNum float d return 4 0f 9 下列选项中 哪一项无法声明类的子类 A static class FooBar B private class FooBar C abstract public class FooBar D final public class FooBar E final abstract class FooBar 10 以下代码运行到第几行后 将对第 3 行所创建的浮点数对象进行垃圾回收 1 public class X 2 public Object m 3 Object o new Float 3 14F 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 4 页 共 13 页 4 Object oa new Object 1 5 oa 0 o 6 o null 7 return oa 0 8 9 A 第 5 行后 B 第 6 行后 C 第 7 行后 即 方法返回时 D 不回收 11 以下代码的运行结果是 1 class A 2 public int getNumber int a 3 return a 1 4 5 6 7 public class B extends A 8 public int getNumber int a 9 return a 2 10 11 12 public static void main String args 13 A a new B 14 System out println a getNumber 0 15 16 A 编译成功 并且打印 1 B 编译成功 并且打印 2 C 第 8 行产生错误 导致编译失败 D 第 13 行产生错误 导致编译失败 E 第 14 行产生错误 导致编译失败 12 对以下代码分别如何进行修改 可以让程序通过编译 1 public abstract class Test 2 public abstract void methodA 3 4 public abstract void methodB 5 6 System out println Hello 7 8 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 5 页 共 13 页 A 对 methodA 添加一个方法体 B 将 5 7 行替换成一个半角的分号 C 删除声明 Test 时所用的 abstract 修饰符 D 删除声明 methodB 时所用的 abstract 修饰符 E 删除声明 methodA 时所用的 abstract 修饰符 F 删除整个方法 methodB 并将第 1 行的 class 改为 interface 13 调用下列选项中的哪项命令行 可以使以下代码的输出结果为 baz 2 1 public class Test 2 public static void main String args 3 String foo args 1 4 String bar args 2 5 String baz args 3 6 System out println baz baz 7 8 A java Test 2222 B java Test 1 2 3 4 C java Test 4 2 4 2 D java Test 4 3 2 1 14 下列选项中 哪三项是与下列代码中的第 2 行等效的 1 public interface Foo 2 int k 4 3 A final int k 4 B public int k 4 C static int k 4 D private int k 4 E abstract int k 4 F volatile int k 4 G transient int k 4 H protected int k 4 15 以下代码的运行结果是 1 public class X 2 private static int a 3 5 public static void main String args 6 modify a 7 System out println a 8 9 10 public static void modify int a 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 6 页 共 13 页 11 a 12 13 A 程序运行并打印 0 B 程序运行并打印 1 C 程序运行 但是由于异常而中止 D 第 5 行产生 possible undefined variable 错误 导致编译失败 E 第 11 行产生 possible undefined variable 错误 导致编译失败 16 在第 1 行的 pointX 处写入下列选项中的哪项代码可以使以下代码编译并执行 1 point X 2 public class Foo 3 public static void main String args throws Exception 4 java io PrintWriter out new java io PrintWriter 5 new java io OutputStreamWriter System out 6 out println Hello 7 8 A import java io B include java io C import java io PrintWriter D include java io PrintWriter E 不需要写入任何语句 17 下列选项声明的方法中 哪一项对其同一包内的所有成员都可以使用 且不用实例化该类就可 以引用 A abstract public void methoda B public abstract double methoda C static void methoda double d1 D public native double methoda E protected void methoda double d1 18 在第 4 行的 Point X 处 写入下列哪项代码 可以使以下代码编译成功 1 public class ExceptionTest 2 class TestException extends Exception 3 public void runTest throws TestException 4 public void test Point X 5 runTest 6 7 A throws Exception B catch Exception e C throws RuntimeException D catch TestException e E 无需写入任何代码 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 19 下列哪 4 种对象可以通过 throw 语句被抛出 A Error B Event C Object D Exception E Throwable F RuntimeException 20 下列关于数据封装的选项中 哪两项是正确的 A 成员变量没有访问修饰符 B 成员变量可以直接被修改 C 方法的访问修饰符是 protected D 成员变量的访问修饰符是 private E 提供一个或多个方法实现对数据的访问和修改 21 以下哪种方法可以用于创建线程 选 2 种 A Extend java lang Thread and override the run method B Extend java lang Runnable and override the start method C Implement java lang Thread and implement the run method D Implement java lang Runnable and implement the run method E Implement java lang Thread and implement the start method 22 下面这段代码编译和运行时会如何显示 import java awt public class Butt extends Frame public static void main String argv Butt MyBut new Butt Butt Button HelloBut new Button Hello Button ByeBut new Button Bye add HelloBut add ByeBut setSize 300 300 setVisible true BCD A Hello Bye Hello Bye Hello Bye 23 下面这段代码编译时会发生什么情况 public class MyClass public static void main String arguments amethod arguments public void amethod String arguments System out println arguments System out println arguments 1 第 7 页 共 13 页 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 8 页 共 13 页 A 错误 不能在静态方法中引用非静态成员 B 错误 main 方法不正确 C 错误 数组应该有下标 D 错误 amethod 方法参数应为 String 24 下列那一行代码编译后不会出现警告或错误 A char c a B byte b 257 C boolean b null D int i 10 E float f 1 3 25 当下面这段程序编译并运行时会出现什么结果 public class MyClass static int i public static void main String argv System out println i A Error Variable i may not have been initialized B null C 1 D 0 26 Servlet 类为 com abc TaxUtil 则 TaxUtil class 文件被保存在哪里 A WEB INF B WEB INF classes C WEB INF lib D WEB INF classes com abc 27 需要发送一个 GIF 文件给客户端的浏览器 下面哪条语句需要被调用 调用应该发生在 response getWriter 语句之前还是之后 A response setContentType image gif Before B response setContentType image gif After C response setDataType image gif Before D response setDataType image gif After 28 Consider the following HTML page code POST Which method of HelloServlet will be invoked when the hyperlink displayed by the above page is clicked A doGet B doPost C doForm D serviceGet 29 Which of the following deployment descriptor snippets correctly associates a servlet implemented by a class named com abc SalesServlet with the name SalesServlet A com abc SalesServlet SalesServlet 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 9 页 共 13 页 B SalesServlet com abc SalesServlet C SalesServlet com abc SalesServlet D SalesServlet 30 A web application is located in a directory named sales Where should its deployment descriptor be located A sales B sales deployment C sales WEB D sales WEB INF 31 为了统计一个用户发出的所有 GET 请求的次数 需要在 doGet 方法中处理 下面哪项写法是 正确的 A HttpSession session request getSession int count session getAttribute count session setAttribute count count B HttpSession session request getSession int count int session getAttribute count session setAttribute count count C HttpSession session request getSession int count Integer session getAttribute count intValue session setAttribute count count D HttpSession session request getSession int count Integer session getAttribute count intValue session setAttribute count new Integer count 32 下面哪条语句使用 URL 重写机制来支持 session A HttpServletRequest encodeURL B HttpServletRequest rewriteURL C HttpServletResponse encodeURL D HttpServletResponse rewriteURL 33 Consider the following servlet code public class TestServlet extends HttpServlet private static StringBuffer staticVar new StringBuffer private StringBuffer instanceVar new StringBuffer public void doGet HttpServletRequest req HttpServletResponse res 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 10 页 共 13 页 private StringBuffer localVar new StringBuffer 上面那些变量是线程安全的 A staticVar B instanceVar C localVar D None 34 What will be the output of the following code Select one x A x 3 5 B x 3 7 C x 5 3 D x 5 7 35 下面那个不是 JSP 页面中的隐含对象 A application B session C exception D useBean 36 在一个 JSP 输出的页面中可以包含另一个 JSP 的输出 下面那个 JSP 标签能够在处理客户请求 时动态包含另一个页面输出的内容 A B C D 37 确定与下面 Servlet 中代码等效的 JSP 的表示方式 RequestDispatcher rd request getRequestDispatcher world jsp rd forward request response A B C D 38 Which of the following is a valid way of getting a bean s property A B C D 39 Which of the following is a valid taglib directive A B C D 40 Consider the following servlet code public void service HttpServletRequest request HttpServletResponse response throws IOException ServletException 1 下面哪条语句在应用 application 范围内查找 name 为 address 的 JavaBean A getServletContext getAttribute address 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 11 页 共 13 页 B application getAttribute address C request getAttribute address APPLICATION SCOPE D pageContext getAttribute address APPLICATION SCOPE 41 下面哪项代码用于转发请求 A RequestDispatcher rd request getRequestDispatcher servlet DataServlet rd forward request response B RequestDispatcher rd request getRequestDispatcher servlet DataServlet rd forward response C RequestDispatcher rd request getRequestDispatcher rd forward servlet DataServlet request response D RequestDispatcher rd request getRequestDispatcher rd forward servlet DataServlet 42 与 HTTP 请求中的参数传递类似 user mary 下面哪一项可以正确地传递参数到被包含的页面 A B C D 43 Consider the following code public void doGet HttpServletRequest req HttpServletResponse res HttpSession session req getSession ServletContext ctx this getServletContext if req getParameter userid null String userid req getParameter userid 1 为了在处理此次用户请求的其它地方使用 userid 的参数值 应该在 1 的位置插入哪条语句 A this setAttribute userid userid B req setAttribute userid userid C ctx addAttribute userid userid D session addAttribute userid userid 44 客户端的浏览器禁用了 cookies 下面的描述正确的是 A You cannot maintain client state B URLs displayed by static HTML pages may not work properly C You cannot use URL rewriting 东软 IT 人才实训中心考试专用试卷东软 IT 人才实训中心考试专用试卷 第 12 页 共 13 页 D You cannot set session timeout explicitly 45 下面哪一项可以存取 ServletContext 对象中的 JavaBean A B C D E None of the above 二 多项选择 46 在 JSP 中使用 Custom Tag 与使用 Scriptlet 代码相比 优势在于 A 不使用 Java 技术就可以进行

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论