javazx 发表于 2016-7-27 14:23:29

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

java软件工程师笔试题目(III)          规则: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:11. String test= “a1b2c3”;
12. String[] tokens = test.split(”\\d”);
13. for(String s: tokens) System.out.print(s +“ “);
What is the result?
A. a b c
B. 1 2 3
C. a1b2c3
D. a1 b2 c3
E. Compilation fails.
F. The code runs with no output.
G. An exception is thrown at runtime. Question 8 Question 9 Question 10请选择同向的图形: Question 11 Question 12表USER_INFO的结构如下:
USER_INFO_IDVARCHAR2(36)PRIMARY KEY
USER_NAMEVARCHAR2(200)NULL
PASSWORDVARCHAR2(200)NULL
下面那些选项可以插入一行到该表中:A、INSERT INTO USER_INFO(USER_INFO_ID, USER_NAME, PASSWORD) VALUES(null,'BQ','password');B、INSERT INTO USER_INFO VALUES('helloword_id','BQ','password');C、INSERT INTO USER_INFO(USER_INFO_ID) VALUES('helloword_id');D、INSERT INTO USER_INFO(USER_INFO_ID, USER_NAME, PASSWORD) VALUES('helloword_id','BQ','password'); Question 13下面关于视图说法正确的是:A、一个视图可以作为只读被创建。B、一个视图可以用来连接两个或者更多的表而创建。C、一个视图在select语句中不能有一个order by 语句。D、一个视图在select语句中不能同group by 语句一起创建。E、一个视图必须在select语句中为列名定义别名。 Question 14EMPLOYEES表数据如下:
NAMEDEPARTMENTSALARY
ZHANGSAN风控部3000
LISI运营部3500
WANGWUIT部40000
ZHAOLIU办公室6000
选择下面正确的选项:A、SELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES GROUP BY DEPARTMENT);B、SELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES GROUP BY DEPARTMENT);C、SELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES);D、SELECT * FROM EMPLOYEES WHERE SALARY>ALL(SELECT SALARY FROM EMPLOYEES); Question 15STUDENTS表为空表,添加主键STUDENT_ID列,那个选项能完成这个任务:A、ALTER TABLE STUDENTS ADD PRIMARY KEY STUDENT_ID;B、ALTER TABLE STUDENTS ADD CONSTRAINT PRIMARY KEY (STUDENT_ID); C、ALTER TABLE STUDENTS ADD CONSTRAINT STUD_ID_KEY PRIMARY KEY (STUDENT_ID);D、ALTER TABLE STUDENTS ADD CONSTRAINT STUD_ID_KEY PRIMARY KEY STUDENT_ID; Question 16 一个学生只能就读于一个班级,而一个班级可以同时容纳多个学生,学生与班级之间是()的关系。 A、一对一 B、一对多 C、 多对一 D、多对多
页: [1]
查看完整版本: 【java笔试题】某金融公司java面试题 初级 珍藏