已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
西安电子科技大学 考试时间 120 分钟试 题题号III总分分数1.考试形式:闭卷;2.考试日期: 年 月 日3.本试卷共 2 大题,满分100分。班级 学号 姓名 任课教师 Note: Write all answers on the answer sheet. Question I: Multiple choices (2*20=40 points)1. Which JDK command is correct to run a Java application in myProgram.java?A. java myProgramB. java myProgram.classC. javac myProgram.javaD. javac myProgram2. Which of the following definitions defines a legal interface?A. interface A abstract void unfinished() B.interface A abstract void unfinished();C.interface A void unfinished();D.public interface A abstract void unfinished();3. Which of the following statements are false?A. A class can only extend one classB. A class can implement more than one interfaceC. An interface can not extend other interfacesD. An interface can extend more than one interface4. Which of the following keywords not belong to the java keywords? A. const B. sizeof C. assert D.volatile 5. Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a default constructor. Which of the following is not correct?A. A a = new A();B. A a = new B();C. B b = new B();D. B and C are correct6. Analyze the following code, the result is:public class Test public static void main(String args) B b = new B(); b.m(5); b.m(23.0); System.out.println(d is + b.d); class A protected int i; public void m(int i) this.i = i; class B extends A double d; public void m(double d) this.d +=d+i; A. d is 28.0.B. run-time error.C. compile error.D. d is 23.0. 7. What will the following program display when you attempt to compile and run it?public class Test /#1 public static void main(String args) Object a1 = new A(); Object a2 = new A(); A a3 = new A(); A a3 = new A(); String s1=”Hello!”; String s2=”Hello!”; System.out.println(a1.equals(a2); System.out.println(a3.equals(a4); System.out.println(s1.equals(s2); class A int x; public boolean equals(A a) return this.x = a.x; A. B. C. D. truetruefalsefalsefalsetruetruetruetruefalsefalsetrue8. Which one of the following statements is not correct?A. int a20; B. int a=1,2,3,4,5;C. int a; D. int a; a=new int2; a=new int23; a0=new int2; a1=new int3;9. If str is a variable with String type, which one of following can get its length?A. str.length() B. str.lengthC. str.size()D. str.size10. Suppose you have classes Vehicle,Engine, Wheel and Window, and you want to build a Car, which of the following concepts is best suitable for it?A. InheritanceB. Inheritance with Extension C. CompositionD. Composition and Inheritance11. Which of the following statements is not correct?A. Collection c=new TreeSet();B. Collection c=new LinkedList(); C. Collection c=new Stack();D. Collection c=new HashMap();12. Construct an instance of class ArrayList which implementation of the List interface which inherits the Collection interface. Which of the following statements is true where E is String? A. ArrayList myCollection = new String();B. Collection myCollection = new ArrayList();C. ArrayList myCollection = new Collection();D. Collection myCollection = new Collection();13. Which of the following statements creates an instance of Directory on Window for the Directory D:Myfile?A. new File(D:Myfile) B. new File(D:Myfile)C. new File(D:/Myfile) D. new File(D:/Myfile)14. Which of the following expressions must be true if you create a thread using Thread object = new Thread()?A. object instanceof JFrameB. object instanceof FrameC. object instanceof AppletD. object instanceof Runnable15. In which class/collection is the wait() method defined? A. Applet B. RunnableC. Thread D. Object 16. Which of the keywords can makes an object of a class serializable? A.transient B. private C. static D. serializable 17. Analyzing the following code, which of following statements should replace /answer goes hereimport javax.swing.*;public class Display extends JFrame public Display() super(Display); / answer goes here JLabel hello=new JLabel(Hello); JPanel pane=new JPanel(); pane.add(hello); setContentPane(pane); pack(); setVisible(true); public static void main(String args) Display ds =new Display(); A. setSize(300,200);B. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);C. Display ds=new Display();D. no statement18. Which is the following program result?public class Apublic static void main(String args) String s=if (a=3) a=0;n; char buf=new chars.length(); s.getChars(0,s.length(),buf,0); CharArrayReader in=new CharArrayReader(buf); PushbackReader f=new PushbackReader(in); int c; try while(char)(c=f.read() !=-1) switch(c) case =: if(c=f.read()=) System.out.print(.eq.); else System.out.print(-); f.unread(c); break; default: System.out.print(char)c); break; catch(IOException e)System.out.print(error!); A. if (a-4) a.eq.0 B. if (a.eq.4) a.eq.0C. if (a.eq.4) a-0D. if (a-4) a-019. When an object of a thread invoke sleep method, which state will the thread object enter into?A.new B. block C. runnable D. destroy 20. which is the following program result?public class Demopublic static void main(String args) SuperClass s=new SuperClass(2); SuperClass s1=new SubClass(2,3.4); s.display(); s1.display(); class SuperClass private int
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026医疗外包服务产业市场竞争分析及投资策略规划报告
- 公司固定资产安全检查方案
- 2026区块链技术在物流园区信息平台建设中的应用前景报告
- 储能电站土建收尾成品保护方案
- 风电吊装平台节能方案
- 包装饮用水项目包装线布局方案
- 《公路施工手册桥涵》
- 防火建筑构件表面防护方案
- 防火建筑材料验收抽检方案
- 美国债务变迁对家庭消费的涟漪效应:基于实证视角的深度剖析
- 2025年上海社区工作者招聘考试笔试试题(含答案)
- 2026中远海运集团招聘考试参考题库及答案解析
- 结构设计弯矩二次分配法计算表格自带公式
- 知道智慧树油气装备工程(山东联盟)满分测试答案
- 2025国铁集团考试题库及答案
- 北京东城区2024-2025学年七年级下学期期末数学试卷(解析版)
- 综合行政执法面试题及参考答案
- 健康体重 快乐成长
- 邮政行测考试试题及答案
- 七年级语文上册《古代诗歌四首》理解性默写与训练
- T/GXAS 830-2024经桡动脉穿刺介入诊疗患者术肢管理规范
评论
0/150
提交评论