上海慧广科技发展有限公司 Java 笔试题
一、选择题部分
题目说明: 道题目,为多项选择题,有些题可能有不止一个答案正确 个答案正确, 题目说明: 本部分一共有 20 道题目,为多项选择题,有些题可能有不止一个答案正确,请 将你认为的正确答案都列出。 题为英文, 题为中文题目。 将你认为的正确答案都列出。前 15 题为英文,后 5 题为中文题目。 1:Which declarations will allow a class to be started as a standalone program? A) public void main(String args[]) B) public void static main(String args[]) C) public static main(String[] argv) D) public static void main(String args[]) 2:you need to create a class that will store unique object elements. you do not need to sort these elements but they must be unique. what interface might be most suitable to meet this need? A)set B)list C)map D)vector 3. Which of the following are Java keywords? a) array b) boolean c) Integer d) protect e) super 4. After the declaration: char[] c = new char[100]; what is the value of c[50]? a) 50 b) 49 c) ‘\u0000′ d) ‘\u0020′ e) " " f) cannot be determined g) always null until a value is
5. Which identifiers are valid? a) _xpoints b) r2d2 c) bBb$ d) set-flow e) thisisCrazy 6. Which of the following statements assigns "Hello Java" to the String variable s? a) String s = "Hello Java"; b) String s[] = "Hello Java"; c) new String s = "Hello Java"; d) String s = new String("Hello Java"); 7. Which of the following are legal declarations of a two-dimensional array of integers? a) int[5][5]a = new int[][]; b) int a = new int[5,5]; c) int[]a[] = new int[5][5]; d) int[][]a = new[5]int[5]; 8. If val = 1 in the code below: switch( val ) { case 1: System.out.print( "P" ); case 2: case 3: System.out.print( "Q" ); break; case 4: System.out.print( "R" ); default: System.out.print( "S" ); } Which values would be printed? a) P b) Q c) R d) S
9. Which methods are required to implement the interface Runnable. a) wait() b) run() c) stop() d) update()
e) resume() 10. What gets printed when the following JSP code is invoked in a browser. Select the one correct answer. <%= if(Math.random() < 0.5){ %> hello <%= } else { %> hi <%= } %> a. The browser will print either hello or hi based upon the return value of random. b. The string hello will always get printed. c. The string hi will always get printed. d. The
JSP file will not compile.
11.Which of the following classes can handle the Unicode? A. B. C. D. InputStreamReader BufferedReader Writer PipedInputStream
12.Name the class that includes the getSession method that is used to get the HttpSession object. A. HttpServletRequest B. HttpServletResponse C. SessionContext D. SessionConfig
13.Which statement, unbinds an attribute from a session? A. session.unbind("key"); B. session.remove("key"); C. session.removeAttribute("key"); D. session.unbindAttribute("key");
14.Within a web application deployment descriptor
, which maps the com.example.LoginServlet servlet to /utils/LoginServlet? A.
com.example.LoginServlet /utils/LoginServlet B.
com.example.LoginServlet /utils/LoginServlet C.
com.example.LoginServlet Login Servlet /utils/LoginServlet /servlet-mapping> D.
Login.Servlet com.example.LoginServlet Login.Servlet /utils/LoginServlet 15.In
Javascript, What does "1"+2+4 evaluate to? A.7 B.124 C.16 D.34 16.若在某一个类定义中定义有如下的方法:abstract void performDial( );该方法属于 A、本地方法 B、最终方法 C、静态方法 D、抽象方法
17.在 Java 中, 。
A. B. C. D.
一