javazx 发表于 2016-7-27 14:24:21

【java笔试题】某金融公司java面试题 中级 珍藏

java软件工程师笔试题目(II)    规则:1. 时间:40分钟 2. 个人独立完成,不能使用手机等上网上查询。如果被发现作弊,则零分。3. 为了环保和节约纸张,请在答题卡上填写答案一、不定项选择题(每题5分)Question 1Given:11. public class Test {
12. public static void main(String [] args) {
13. int x =5;
14. boolean b1 = true;
15. boolean b2 = false;
17.if((x==4) && !b2)
18. System.out.print(”l “);
19. System.out.print(”2 “);
20. if ((b2 = true) && b1)
21. System.out.print(”3 “);
22. }
23. }
What is the result?
A. 2
B. 3
C. 1 2
D. 2 3
E. 1 2 3
F. Compilation fails.
G. Au exceptional is thrown at runtime. Question 2Assume that country is set for each class.Given:10. public class Money {
11. private String country, name;
12. public String getCountry() { return country; }
13.}and:24. class Yen extends Money {
25. public String getCountry() { return super.country; }
26. }
27.
28. class Euro extends Money {
29. public String getCountry(String timeZone) {
30. return super.getCountry();
31. }
32. }
Which two are correct? (Choose two.)A. Yen returns correct values.
B. Euro returns correct values.
C. An exception is thrown at runtime.
D. Yen and Euro both return correct values.
E. Compilation fails because of an error at line 25.
F. Compilation fails because of an error at line 30. Question 3Given:1. class TestA {
2. public void start() { System.out.println(”TestA”); }
3. }
4. public class TestB extends TestA {
5. public void start() { System.out.println(”TestB”); }
6. public static void main(String[] args) {   
7. ((TestA)new TestB()).start();
8. }
9. }
What is the result? A. TestA
B. TestB
C. Compilation fails.
D. An exception is thrown at runtime. Question 4Given:11. public static void main(String[] args) {
12. String str = “null’;
13. if (str == null) {   
14. System.out.println(”null”);
15. } else (str.length() == 0) {   
16. System.out.println(”zero”);
17. } else {
18. System.out.println(”some”);
19. }
20. }
‘What is the result?A. null
B. zero
C. some
D. Compilation fails.
E. An exception is thrown at runtime. Question 5Given:33. try {
34. // some code here
35. } catch (NullPointerException e1) {
36. System.out.print(”a”);
37. } catch (RuntimeException e2) {
38. System.out.print(”b”);
39. } finally {
40. System.out.print(”c”);
41. }
What is the result if a NullPointerException occurs on line 34?
A. c
B. a
C. ab
D. ac
E. bc
F. abc Question 6Given this method in a class:21. public String toString() {
22. StringBuffer buffer = new StringBuffer();
23. buffer.append(’<’);
24. buffer.append(this.name);
25. buffer.append(’>’);
26. return buffer.toString();
27. }
Which is true?A. This code is NOT thread-safe.
B. The programmer can replace StringBuffer with StringBuilder with no
other changes.
C. This code will perform well and converting the code to use
StringBuilder will not enhance the performance.
D. This code will perform poorly. For better performance, the code
should be rewritten: return “<“+ this.name + “>”; Question 7Given:14. DateFormat df;
15. Date date = new Date();
16. //insert code here
17. String s = df.format( date);
Which two, inserted independently at line 16, allow the code to compile? (Choose two.)A. df= new DateFormat();
B. df= Date.getFormatter();
C. df= date.getFormatter();
D. df= date.getDateFormatter();
E. df= Date.getDateFormatter();
F. df= DateFormat.getInstance();
G. df = DateFormat.getDateInstance(); Question 8为数据库中一个或者多个表中的数据提供另外一种查看方式的逻辑表被称为()。(选择一项)A. 存储过程 B. 数据库关系图 C. 视图 D. 表 Question 9 已知employee表中具有默认约束df_email,删除该约束的语句为()。A. alter talbe employee drop constraint df_email B. alter talbe employee remove constraint df_email C. alter talbe employee delete constraint df_email D. remove constraint df_email from talbe employee Question 10 将E-R图转换为表的过程中,如果实体之间存在多对多的关系,通常的做法是()。 A. 在两个实体间建立主外键关系。 B. 在两个实体间建立关联表,把一个多对多的关系分解成两个一对多的关系。 C. 在两个实体间建立关联表,把一个多对多的关系分解成两个一对一的关系。 D. 在两个实体间不建立任何关系。 Question 11假设有scores表的设计如下: ID(编号,主键) StudentID(学生编号) CourseID(课程编号) Score(分数) 现在要查询参加过至少两门课程考试的学生各门课程的平均成绩。以下SQL语句正确的是()。 A. select StudentID,avg(score) from scores group by StudentID having count(studentID)>1 B. select StudentID,avg(score) from scores group by StudentID where count(studentID)>1 C. select StudentID,avg(score) from scores group by StudentID where count(studentID)>1 group by StudentID D. select StudentID,avg(score) from scores having count(studentID)>1 Question 12在()的列上更适合创建索引。A. 需要对数据进行排序 B. 具有默认值 C. 频繁更改 D. 频繁搜索 Question 13(hibernate)以下哪个选项不是持久化层的对象状态? A.临时状态B.独立状态C.游离状态D.持久化状态 Question 14设计模式一般用来解决什么样的问题( ) A.同一问题的不同表相    B不同问题的同一表相   C.不同问题的不同表相    D.以上都不是 Question 15设计模式的两大主题是() A.系统的维护与开发       B 对象组合与类的继承   C.系统架构与系统开发   D.系统复用与系统扩展 Question 16单子模式中,两个基本要点()和单子类自己提供单例    A .构造函数私有    B.唯一实例   C.静态工厂方法   D.以上都不对 二、简答题(每题5分)1、AOP和IOC的概念以及在spring中是如何应用的。2、简单描述hibernate持久化对象三种状态转换关系。3、spring的事务有几种方式?并描述spring事务的隔离级别和传播行为。4、简要阐述struts2的执行流程。
页: [1]
查看完整版本: 【java笔试题】某金融公司java面试题 中级 珍藏