exam2Word版

上传人:日度 文档编号:215062654 上传时间:2021-11-24 格式:DOC 页数:9 大小:91KB
返回 下载 相关 举报
exam2Word版_第1页
第1页 / 共9页
exam2Word版_第2页
第2页 / 共9页
exam2Word版_第3页
第3页 / 共9页
exam2Word版_第4页
第4页 / 共9页
exam2Word版_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《exam2Word版》由会员分享,可在线阅读,更多相关《exam2Word版(9页珍藏版)》请在金锄头文库上搜索。

1、Java项目实训理论阶段考试姓名:_学员编号:_以下由阅卷老师填写:题号第一部分第二部分总分阅卷人一二小计一二三四小计分数评语第一部分(共40分)一、(10x3分)单选题,选择最适合的答案1.For the code below:class Test private int m;public static void fun() / some codeHow to make the member variable m be visited by the function fun()? (B)(A)Change private int m to protected int m(B)Change p

2、rivate int m to public int m(C)Change private int m to static int m(D)Change private int m to int m2.For code below:class DataServer extends Server public String serverName;public DataServer() serverName = Customer Service;super(serverName);Which statement is right? ( )A.Code can pass the compilatio

3、nB.Code can pass the compilation but a fault would happen in creating object of DataServerC.Code can NOT pass the compilation for the error in the 2nd lineD.Code can NOT pass the compilation for the error in the 5th line3.Which statement below is incorrect: ( )A.float a = 2.0B.double b=2.0C.int c=2D

4、.long d=24. Which one below is correct to define and create an array? ( )A.int a5;B.int a = new 5;C.int a = 1,2,3,4,5;D.int a = new int5;5. For the code below, which one can replace the line 7? ( )public class Base int w,x,y,z;public Base(int a, int b) x=a;y=b;public Base(int a, int b, int c, int d)

5、 x=a; y=b;/line 7w=d; z=c;A.Base(a,b)B.this(a,b,x,y)C.this(a,b)D.Base(x,y)6.For code below:String s = story;which of the following is true ?A:s += books;B:char c = s1;C:int len = s.length;D:byte t = s0;7. If a method defined in a derived class has the same name, return type and parameters with the b

6、ase one, we call this situation as: ( )A.overloadB.overrideC.inheritanceD.construction8. Which line is the right sequence to declare in one compile unit? ( )A.package,import,classB.class,import,packageC.import,package,classD.package,class,import9.What will happen if you try to compile and execute Bs

7、 main() method?( ) class A int i;A(int i) this.i = i * 2;class B extends A public static void main(String args) B b = new B(2);B(int x) System.out.println(x);A.The instance variable i is set to 4B.The instance variable i is set to 2C.The instance variable i is set to 0D.This code will not compile10.

8、 For the code below, which statement is right? ( )public class MyClass static int myArg = 1;public static void main(String args) int myArg;System.out.println(myArg);A.Compiles, result is 1B.Compiles, result is 0C.Compile error for no initialization for myArgD.Compile error for local variable myArg h

9、as the same name with a static one二、(5*2分) 完成程序。1、简单介绍下jdk1.5引入的新特性和这些新特性的基本用法。(5分)2、写一个类,保证用户只能拿到这个类的唯一的实例. (5分) 第二部分(共60分)一、数据库(10分)1、有如下两张表: 部门表dept (deptId -部门编号 ,dName-部门名称 );员工表emp (empNo-部门编号, eName- 员工名称, deptId-部门编号)注意: emp的deptId 是dept表 deptId的外键),dname并没有唯一性约束。用一条sql语句查询每个部门共有多少人. 并且显示的部门

10、要求人数3.(3分)结果如下:dName employeeNum 人力资源部 5财务部 6销售部 4 2、有以下三个表:学生基本信息表:有学号,姓名,班级,年龄 :student(stuid,sname , class, age );课程表:有课程编号,课程名称: course (courseid , cname )学生选课表:有学号,课程编号,成绩: stu_cou (stuid,courseid, score )用一句sql找出选了全部课程的学生的姓名和年龄.(3分)用一句sql找出不合格课程在两门以上的学生姓名和平均分. (3分)二、jsp 和 servlet(15分)1、JSP有几大内

11、置对象,举例说明,每个对象常用的方法有哪些?(5分)2、描述JSP和Servlet的区别、共同点、各自应用的范围。(5分)3、请问Servlet线程安全吗? 如果说是线程安全的话,它是怎么来实现线程安全的? 如果是线程不安全的话,Servlet中的线程不安全是因为什么引起的,有哪几种解决方案.请详细解答?(5分)三、Struts2(10分)1、STRUTS2是一个什么样的框架,在项目开发当中,工作在哪个层次?struts2框架线程安全吗?它在JAVA WEB开发中的作用是什么?简述一下struts2的原理及流程(5分)2、如果要在JAVA WEB项目中运用struts2技术,至少需要两个XML配置文件,请说明这两个配置文件的文件名,以及这两个配置文件需要配置的大概内容及其作用 (5分)四、Hibernate(10分)1、看以下hbm配置文件片断:请问Hiberante是一个什么样的框架,在项目开发当中,工作在哪个层次?以上代码当中inverse属性的含义是什么?cascade属性又是什么含义?(5分)2、请看以下hbm配置文件片断 请问这里lazy属性的含义,默认值是多少?请举例说明hibernate批量加载的含义,如何设置?如果我设置了延迟加载为true,如果在session关闭之后才去关联的对象,是否会出错,怎么解决?(5分)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号