Java编程思想 第4版 期末试卷及答案 ([美]Bruce)
期末试卷配套教材:
书名:Java编程思想 第4版
作者:[美]Bruce Eckel 著 陈昊鹏 译
出版社:机械工业出版社
期末试卷概述:
Note: Write all your answers on the Answer Sheets. SECTION 1: Choose ONE Correct Answer to Each Question (30 points, 2 points each) 1. Which method is used to draw a string starting at point(x,y)? ( ) A. drawImage B. drawString C. drawRect D. drawLine 2. Which of the following are methods of the Runnable interface? ( ) A. run B. start C. yield D. stop 3. Which class can be used to create a socket in server side to wait for connection request from client? ( ) A. Socket B. ServerSocket C. DatagramSocket D. URL 4. To handle mouse dragged event, which interface should be implemented? ( ) A. MouseListner B. MouseMotionListner C. MouseWheelListener D. MouseAdapter 5. Which kind of file is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, HTML files and other resources that together constitute a Web application? ( ) A. war file B. jar file C. zip file D. rar file 6. Which is correct about Applet? ( ) A. Applet is same as Servlet B. Applet can be executed with browser C. Some Applets can be used in mobile phone D. Applet is a Java program which runs in web server 7. Which of the following statement is true? ( ) A. A byte can represent between -128 to 127 B. A byte can represent between -127 to 128 C. A byte can represent between -256 to 256 D. A char can represent between -2*216 to 2*216-1 8. An Applet has its Layout Manager set to the default of FlowLayout. Which code would be correct to change to another Layout Manager? ( ) A. setLayoutManager(new GridLayout()); B. setLayout(new GridLayout(2,2)); C. setGridLayout(2,2); D. setBorderLayout(); 9. Which of the following statements is NOT true? ( ) A. If a class has any abstract methods it must be declared abstract itself. B. All methods in an abstract class must be declared as abstract C. When applied to a class, the final modifier means it cannot be sub-classed D. transient and volatile are Java modifiers 10. Which of the following statement is true? ( ) A. Constructors cannot have a visibility modifier B. Constructors can be marked public and protected, but not private C. Constructors can only have a primitive return type D. Constructors cannot be inherited