金蝶中间件2011校招笔试题_第1页
金蝶中间件2011校招笔试题_第2页
金蝶中间件2011校招笔试题_第3页
金蝶中间件2011校招笔试题_第4页
金蝶中间件2011校招笔试题_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

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

文档简介

一、 单选题(18分,每小题个2分)1关于软件测试的目的,下面观点错误的是()A、未来发现错误而执行程序的过程B、一个好的测试用例能够发现至今尚未发现的错误C、证明程序是正确、没有错误的D、一个成功的测试用例是发现了至今尚未发现的错误的测试 2Given: Integer i = new Integer(42); Long l = new Long(42); Double d = new Double(42.0); Which expression evaluates to True?A. (i = l)B. (i = d)C. (d = 1)D. (i.equals(d)E. (d.equals(l)F. (i.equals(l)G. (l.equals(42L) 3What happens when you try to compile and run the following application?Choose all Correct options.1. public class Z 2. public static void main(String args) 3. new Z();4. 5. 6. Z() 7. Z alias1 = this; 8. Z alias2 = this; 9. synchronized (alias1) 10.try 11.alias2.wait(); 12.System.out.println(DONE WAITING); 13. 14.catch (InterruptedException e) 15.System.out.println(INTERRUPTED); 16. 17.catch (Exception e) 18.System.out.println(OTHER EXCEPTION); 19. 20.finally 21.System.out.println(FINALLY); 22. 23. 24.System.out.println(ALL DONE); 25. 26. AThe application compiles and prints “DONE WAITING” BThe application compiles but doesnt print anything CThe application compiles and print “FINALLY” DThe application compiles and print “ALL DONE” EThe application compiles and print “INTERRUPTED” FThe application compiles and print “DONE WAITING” and “FINALLY”4Consider the following classes:1. class Person2. public void printValue(int i,int j)/*.*/3. public void printValue(int i)/*.*/4. 5. public class Teacher extends Person6. public void printValue()/*.*/7. public void printValue(int i)/*.*/8. public void printValue(String i)/*.*/9. public static void main(String args)10. Person t = new Teacher();11. char ch = y;12. t.printValue(ch);13. 14.Which of the statements below is true?A Line 7 will not compile, because void methods cannot be overriddenB Line 12 will not compile, because there is no version of printValue() that takes a char argumentC The code will compile but will throw an exception at line 12 at runtimeD The statement on line 12 will invoke the method on line 8E The statement on line 12 will invoke the method on line 2F The statement on line 12 will invoke the method on line 3G The statement on line 12 will invoke the method on line 75Consider the following statement, choose all correct options You are given a class hierarchy with an instance of the Class Dog. The class Dog is a child of Mammal and the class Mammal is a child of the class Vertebrate. The class Vertebrate has a method called move which prints out the string “move” . The class Mammal overrides this method and prints out the string”walks”. The class Dog overrides this method and prints out the string “walks on paws”.Given an instance(dog) of the class Dog,how can you access the ancestor method move in Vertebrate so it prints out the string “move”;A dog.super().super().move();B dog.parent().parent().move();C dog.move();D none of the above6What will happen when you attempt to compile and run the following code.public class Test public static void main(String argv) HHQ ht = new HHQ(my name);ht.start();class HHQ extends Thread private String name = ;HHQ(String s) name = s;public void run() inner();System.out.println(finished);public void inner() while (true) try System.out.println(waiting);wait(); catch (InterruptedException ie) System.out.println(name);notifyAll();A It will cause a compile time errorB Compilation and output of “waiting”C Compilation and output of “waiting” followed by “finished”D Runtime error, output of “waiting” and an exception will be thrown 7Which of the following most closely describes the process of overriding?AA class with the same name replaces the functionality of a class defined earlier in the hierarchyBA method with the same name completely replaces the functionality of a method earlier in the hierarchyCA method with the same name but different parameters gives multiple uses for the same method nameDA class is prevented from accessing methods in its immediate ancestor8Given the following code:1 class A2 public void process()System.out.print(A);3 class B extends A4 public void process() throws IOException5 cess();6 System.out.print(B);7 throw new IOException();8 9public static void main(String args) 10try11new B().process();12catch(IOException e)13System.out.println(Exception);14 1516 What will happen when you attempt to compile and run it?A The program will run and output “A”,”B” and “Exception”B The program will run and output “A”C The program will run and output “B” and “Exception”D Compilation fails because of an error in line 11E Compilation fails because of an error in line 4F An IOException will thrown at runtime9What will happen when you attempt to compile and run the following code in JDK 5 environment? 1public class Test2public static void increase(Integer i)3i+;45public static void main(String args)6Integer i = new Integer(0);7increase(i);8System.out.println(i);9 10 ACompilation fails because of an error in line 7 BCompilation fails because of an error in line 3 CThe program will run and output “1” DThe program will run and output a random number EThe program will run and output “0”二、不定项选择题(18分,每小题各2分) 1下述表达正确的有()A、单元测试应该由试人员进行测试B、软件质量是不可量化的C、开发人员应该对代码质量负最主要的责任D、软件配置管理的好坏对软件的最终质量没有影响E、软件运行性能是由硬件配置所制约的,与程序所用的数据结构与算法无关 2Which of the following demonstrate a “has a”relationship?A、public interface Person public class Employee extends Person B、public interface Shape public interface Rectangle extends Shape C、public interface Colorable public class Shape implements Colorable D、public class Species public class Animalprivate Species species;E、interface Component class Container implements Componetprivate Component children;3Which of the following are true for the class java.util.TreeSet? AThe elements in the collection are ordered BThe collection is guaranteed to be immutable CThe elements in the collection are guaranteed to be unique DThe elements in the collection are accessed using a unique key EThe elements in the collection are guaranteed to by synchronized4Given the following code fragment: 1public void create()2. Vector myVect;3 myVect = new Vector();4 Which of the following statement are true?A The statement on line 2 creates an object of class VectorB The declaration on line 2 does not allocate memory space for the variable myVectC The declaration on line 2 allocates memory space for a reference to a Vector objectD The statement on line 3 create an object of class VectorE The statement on line 3 allocates memory space for an object of class Vector5Given the following code: class Base static int oak=99;public class Doverdale extends Basepublic static void main(String argv)Doverdale d = new Doverdale();d.amethod();public void amethod()/HereWhich of the following if placed after the comment/Here,will compile and modify the value of the variable oak?A super.oak=1;B oak=33;C Base.oak=22;D Oak=50.1;6Which of the following statements are true about a variable created with the static modifier? AOnce assigned the value of a static variable cant be altered BA static variable created in a method will keep the same value between calls COnly one instance of a static variable will exist for any amount of class instances DThe static modifier can only be applied to a primitive value7Given the following class: public class Apublic static void main(String argv)boolean b1 = true;if(b1=true)|place(true)System.out.println(Hello True);if(b1 | place(String)null)System.out.println(Hello Null);public static boolean place(boolean location)if(location!=true)System.out.println(world True);System.out.println(World True);return true;public static boolean place(String str)if(str = null | str.length() = 0)System.out.println(World Null);System.out.println(World String);return true; What will happen when you attempt to compile and run it?A Compile failsB Output of “Hello True” C Output of “World Boolean” followed by “Hello True”,”World Null”,”World String” and “Hello Null”D Output of “Hello True” followed by “Hello Null”E Output of “Hello True”, then an exception is thrown at runtimeF Output of “Hello True“ followed by “World null”,”World String” and “Hello Null”8Which statement are true about the garbage collection mechanisms? AThe garbage collection mechanism release memory at predictable times BA correct program must not depend upon the timing or order of garbage collection CGarbage collection ensures that a program will not run out of memory during execution DThe programmer can indicate that a reference through a local variable is no longer going to Java objects EThe programmer has a mechanism that explicitly and immediately frees the memory used by Java objects FThe garbage collection system never reclaims memory from objects while are still accessible to running user threads9What will happen when you attempt to compile and run the following code? 1public class Test2.public static String hello(String strs,String s2)3.strs0 = ;4.s2.toUpperCase();5.return s2;67public static void main(String args)8String a = new String(t);9String b = new Stringt;10String c = ern();11if(a.equals(b0)12System.out.print(1);1314if(b0 = c)15System.out.print(2);1617if(a = c)18System.out.print(3);1920a = hello(b,c);21System.out.print(a);22System.out.print(b1);23System.out.print(c);24 25AThe program will run and output “12tt”BThe program will run and output “123Tt”CThe program will run and output “12Tt”DCompilation fails because of an error in line 4ECompilation fails because of an error in line 9FThe program will run and output “12ttt”三、填空题(每空3分,共51分) 1、如下的代码实现了先进先出队列,请按注释要求填空。(每空各3分,共9分)class FifoQueueprivate transient Node head;private transient Node last;Node enq(Object x) /入队Node p = new Node(x);if(last = null)last = head = p;else 1 ; /请在此补充一条语句return p;Node deq() /出队Node p = head;if( 2 ) /请在此补充一条表达式if(head = p.next) = null)3; /请在此补充一条语句p.next = null;return p;static final class Node/* The item being transferred */Object item;/* Next node in wait queue */Node next;/* Creates a node with initial item */Node(Object x) item = x; 2如下的代码采用合并排序对数组进行排序,请按注释要求填空。(每空各3分,共21分)import java.lang.reflect.Array;import java.util.Random;public class Test/将数组src中的Integer类型的元素按增序排列public static void main(String argv)Object src = new Object100;for(int i = 0;i src.length;i+)srci = new Random().nextInt();Object aux = cloneArray(src);mergeSort(aut,src,0,src.length);for(int i = 0;i src.length;i+)System.out.print(srci + ,);/* * Src is the source array that starts at index 0.数组元素实现java.lang.Comparable接口 * Dest is the destination array that starts at index 0.数组元素实现java.lang.Comparable接口 * low is the index in dest to start sorting * high is the end index in dest to end sorting */private static void mergeSort(Object src,Object dest,int low,int high)int length = high - low;/Insertion sort on smallest arrays. 当待排序元素的个数少于5时,采用插入排序if(length 5)for(int i = low;i 0)Object t = destj; 4; /请在此补充一条语句 5; /请在此补充一条语句return;/Recursively sort halves of dest into srcint mid = (low + high) 1;mergeSort(dest,src,low,mid); 6; /请在此补充一条语句 /If list is already sorted,just copy from src to dest.This is an/optimization that results in faster sorts for nearly ordered lists.if( 7 ) /请在此补充一条表达式System.arraycopy(src, low, dest, low, length);return;/Merge sorted halves (now in src) into destint p = low; 8; /请在此补充一条语句for(int i = low;i high; i+)if( 9 /请在此补充一条表达式 | p mid & (Comparable)srcp).compareTo(srcq) =0)desti = srcp+; else 10; /请在此补充一条语句 /* *Clones an array within the specified bounds. This method assumes that a *is an array. */private static T cloneArray(T a)int n = a.length;T result = (T)Array.newInstance(a.getClass().getComponentType(), n);System.arraycopy(a, 0, result, 0, n);return result;3以下为JDK1.5中java.util.HashMap(哈希表)的实现,请根据给出的代码片段,完成put方法的填空(每空各3分,共6分)package java.util;import java.io.*;import java.security.KeyStore.Entry;public class HashMap extends AbstractMap implements Map,Cloneable,Serializable/* * The table,resized as necessary.Length must always be a power of two. */transient Entry table;/* *The number of key-value mappings contained in this identity hash map. */transient int size;/* * The next size value at which to resize (capacity * load factor). */int threshold;/* * The number of times this HashMap has been structurally modified * Structural modifications are those that change te number of mappings in * the HashMap or otherwise modify its internal structure(e.g. * rehash).This field is used to make iterators on Collection-views of * the HashMap fail-fast. (See concurrentModificationException) */transient volatile int modCount;/其它代码段.省略/* * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key,the old * value is replaced. * * param key key with which the specified value is to be associated. * param value value to be associated with the specified key. * return previous value associated with specified key,or null * if there was no mapping for key.A nullreturn can * al

温馨提示

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

评论

0/150

提交评论