请选择 进入手机版 | 继续访问电脑版
java自学网VIP

Java自学网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3907|回复: 0

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

[复制链接]
  • TA的每日心情
    开心
    2021-5-25 00:00
  • 签到天数: 1917 天

    [LV.Master]出神入化

    2025

    主题

    3683

    帖子

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    66009

    宣传达人突出贡献优秀版主荣誉管理论坛元老

    发表于 2016-7-27 14:23:29 | 显示全部楼层 |阅读模式
    java软件工程师笔试题目(III)
             
    规则:
    1. 时间:40分钟
    2. 个人独立完成,不能使用手机等上网上查询。如果被发现作弊,则零分。
    3. 为了环保和节约纸张,在答题卡上填写答案
    一、不定项选择题(每题5分)
    Question 1
    Given:
    11. public class Test { $ r) B) d3 O/ }5 j6 L! _
    12. public static void main(String [] args) {
    0 e" q* t* j& O/ Z; K( j* Y13. int x =5;
    2 ^' I: ]6 Y- U14. boolean b1 = true;
    ' `" t' l$ @8 v- S/ T' n15. boolean b2 = false;  + b- T, |, I; \  H
    17.if((x==4) && !b2)
    # Q0 }$ l7 z  m/ t18. System.out.print(”l “);
    3 u7 O) m' t, T) L3 Y3 I' N19. System.out.print(”2 “);   P- \) M. U6 w) Y' o( p
    20. if ((b2 = true) && b1)  . e2 v0 e1 B; |
    21. System.out.print(”3 “);
    " t- Z& l: Z8 V' _& G22. } : B# u  S+ `+ K$ G( K6 {5 Q$ G
    23. }
    ) x7 ~" ^# ]3 M$ F! wWhat is the result? - K7 M. `# t) f, J
    A. 2 3 C, Q7 ?) e/ H$ \& B+ M
    B. 3
      Y% g  I4 f) c! m4 \C. 1 2
    1 p, N- ~' L( _0 S) x; TD. 2 3
    + d9 j7 l. \6 v2 Y. a, ^9 j- fE. 1 2 3 4 m! i8 ^8 }" ^4 R
    F. Compilation fails.
    % m3 |' z) v/ {& s: x) q( z4 @G. Au exceptional is thrown at runtime.
    Question 2
    Assume that country is set for each class.
    Given:
    10. public class Money {
    8 p: J# y* M) N11. private String country, name; # }/ T: u& ?% `8 q& c
    12. public String getCountry() { return country; }
    $ U1 b" s( s/ r2 u13.}
    and:
    24. class Yen extends Money { ; v- P  y% k+ U9 x6 S
    25. public String getCountry() { return super.country; } 0 W4 U# z5 E1 F7 A1 r& l6 M
    26. } ( W( ^3 K* r' F1 V
    27. 5 }3 @" R) |: ^1 r. b  ~
    28. class Euro extends Money {
    ; A; z* O" e4 f+ a, d8 Q. m2 R29. public String getCountry(String timeZone) {   f- o1 o: m) b4 L1 d
    30. return super.getCountry(); : I9 Y  ]/ ], p) `/ }0 P1 ]
    31. } : ^* C" D0 S+ q/ s% k, [) U! p( f
    32. } 3 M. ^. E6 p9 B/ a8 X
    Which two are correct? (Choose two.)
    A. Yen returns correct values. & s3 E8 ^5 f9 `6 F# w$ _
    B. Euro returns correct values.
    8 R3 Z1 `  [( X" }3 xC. An exception is thrown at runtime. " x7 F# ?' a( N3 V3 \0 z$ |2 t) r$ o
    D. Yen and Euro both return correct values. 5 T; Q, C2 `3 M8 P  r# b
    E. Compilation fails because of an error at line 25. - w( D* G! E$ i. U4 j  O2 W3 \
    F. Compilation fails because of an error at line 30.
    Question 3
    Given:
    1. class TestA { % Y0 C. v2 e  _
    2. public void start() { System.out.println(”TestA”); } ! p2 ?& i/ l: P1 z
    3. } / W$ _' J- c& U  |: p, m
    4. public class TestB extends TestA {
    , _% @8 M3 x9 q2 p1 f3 ?5. public void start() { System.out.println(”TestB”); }
    , R# E. D2 k0 _6. public static void main(String[] args) {     
    1 l7 h$ \/ p. W3 P: V: n/ |7. ((TestA)new TestB()).start(); 6 |5 o8 }3 e- v- z
    8. } 2 y: N: ^( t) X# J' q
    9. }
    8 h) t0 Y$ ^. R' B  WWhat is the result?
    A. TestA . O) h& S* v  B) \* K% M
    B. TestB 7 l% C2 f% N; T0 X4 u
    C. Compilation fails.
    & h5 c6 o% R6 m/ Y! ID. An exception is thrown at runtime.
    Question 4
    Given:
    11. public static void main(String[] args) {
    9 c- [/ |6 l. R) H; T" e# O12. String str = “null’; ) I+ [/ r  {! N5 D. z0 G7 ]' {" b
    13. if (str == null) {     $ ~5 A7 @5 B. y1 z) ^
    14. System.out.println(”null”);
    7 C2 w9 u- }2 c4 J# I* M15. } else (str.length() == 0) {    ' S' L  p  \9 Z2 j
    16. System.out.println(”zero”); 5 b: T7 H$ [( `/ }
    17. } else {
    ( N6 @7 B% C) b( g* ~* b18. System.out.println(”some”); 9 J7 u2 F. a/ |
    19. }
    ; W# V6 m% o2 `1 x! I  d20. }
    9 s2 q4 r% ^" ^' e‘What is the result?
    A. null
    6 G- W- Q6 d+ y: L5 B9 I9 {. Z) L0 D' oB. zero " l5 E% \  M% G  I% v0 \
    C. some - @' u, E) E2 B9 K0 M0 R
    D. Compilation fails. 1 I, K% O5 K0 L0 e6 i. K+ o) m% F8 B: q
    E. An exception is thrown at runtime.
    Question 5
    Given:
    33. try { + @# o; b' R; P$ K! l/ z
    34. // some code here
    8 z# j6 R- f% R3 P% j9 @35. } catch (NullPointerException e1) {
    ' V1 r( J# J1 m2 u) `. O7 n36. System.out.print(”a”); + j1 a. t$ M8 }
    37. } catch (RuntimeException e2) {
    - l+ R0 h5 I* n  q5 E+ K7 T38. System.out.print(”b”);
    7 Z# x5 J4 a  }39. } finally {
    9 R9 {, v6 h7 m: G0 b40. System.out.print(”c”); 4 ]$ @# ~& x1 j0 F- t  ]3 y" |
    41. }
    $ y: O& P% R$ ]% v/ B6 YWhat is the result if a NullPointerException occurs on line 34? ) T( |+ J: H6 f9 _' T) i$ s
    A. c " M# s6 R' j: v: m! g
    B. a , ~: j. W0 _2 }' q3 }+ `9 C- ~3 L9 ?
    C. ab 9 U4 }) u- K9 O, \8 V
    D. ac
    . s/ L" n; w) w4 p1 aE. bc
    : ^( r; n# W" \6 [) `. v/ O  a7 YF. abc
    Question 6
    Given this method in a class:
    21. public String toString() {
    + Q: B( P- c: O3 \22. StringBuffer buffer = new StringBuffer(); * [! l- n  }5 m
    23. buffer.append(’<’); : i/ u7 Y* d. f9 X2 O9 h
    24. buffer.append(this.name);
    . v3 ~* a# W" O* C. k25. buffer.append(’>’);
    $ V! M3 H5 j! {/ ?/ ]2 `8 t0 x" _26. return buffer.toString(); . R' h" o$ E/ D( c
    27. }
    3 Z' \7 w5 }& N# m6 k4 o3 H3 qWhich is true?
    A. This code is NOT thread-safe.
    8 K9 a9 f$ g. CB. The programmer can replace StringBuffer with StringBuilder with no & k: e/ K  P. H& z8 w6 X6 O
    other changes. 9 {9 j/ ^# e5 t+ w
    C. This code will perform well and converting the code to use ' s! C# p2 S2 n5 c  k3 ~! f' {
    StringBuilder will not enhance the performance.
    ( }, Z8 |! Z7 ]$ tD. This code will perform poorly. For better performance, the code
      r8 {7 R% ~( z9 T; M6 q+ tshould be rewritten: return “<“+ this.name + “>”;
    Question 7
    Given:
    11. String test= “a1b2c3”;
    4 G% X5 ?/ W" e2 R* W- R12. String[] tokens = test.split(”\\d”);  
    0 {& I, }# c2 {* @3 z13. for(String s: tokens) System.out.print(s +“ “);
    9 C- w9 O5 D! y! c, OWhat is the result?
    ( K2 N7 d7 W  |A. a b c 7 v: H0 U4 J2 o) l4 A' r
    B. 1 2 3 ; ^* W% M; P  _7 ~* U
    C. a1b2c3 & J9 c5 E5 {1 t0 J" W) w2 t# ^8 y
    D. a1 b2 c3 $ _! |. W; U& S" @$ P
    E. Compilation fails. ( `. u. \. N: {# k7 @) P
    F. The code runs with no output.
    ( m4 X& V- g; ?& }G. An exception is thrown at runtime.
    Question 8
    8.png
    Question 9
    9.png
    Question 10
    请选择同向的图形:
    10.png
    Question 11
    11.png
    Question 12
    USER_INFO的结构如下:
    USER_INFO_ID
    VARCHAR2(36)
    PRIMARY KEY
    USER_NAME
    VARCHAR2(200)
    NULL
    PASSWORD
    VARCHAR2(200)
    NULL
    下面那些选项可以插入一行到该表中:
    AINSERT INTO USER_INFO(USER_INFO_ID, USER_NAME, PASSWORD) VALUES(null,'BQ','password');
    BINSERT INTO USER_INFO VALUES('helloword_id','BQ','password');
    CINSERT INTO USER_INFO(USER_INFO_ID) VALUES('helloword_id');
    DINSERT 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 14
    EMPLOYEES表数据如下:
    NAME
    DEPARTMENT
    SALARY
    ZHANGSAN
    风控部
    3000
    LISI
    运营部
    3500
    WANGWU
    IT
    40000
    ZHAOLIU
    办公室
    6000
    选择下面正确的选项:
    ASELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES GROUP BY DEPARTMENT);
    BSELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES GROUP BY DEPARTMENT);
    CSELECT * FROM EMPLOYEES WHERE SALARY>(SELECT MIN(SALARY) FROM EMPLOYEES);
    DSELECT * FROM EMPLOYEES WHERE SALARY>ALL(SELECT SALARY FROM EMPLOYEES);
    Question 15
    STUDENTS表为空表,添加主键STUDENT_ID列,那个选项能完成这个任务:
    AALTER TABLE STUDENTS ADD PRIMARY KEY STUDENT_ID;
    BALTER TABLE STUDENTS ADD CONSTRAINT PRIMARY KEY (STUDENT_ID);
    CALTER TABLE STUDENTS ADD CONSTRAINT STUD_ID_KEY PRIMARY KEY (STUDENT_ID);
    DALTER TABLE STUDENTS ADD CONSTRAINT STUD_ID_KEY PRIMARY KEY STUDENT_ID;
    Question 16
    一个学生只能就读于一个班级,而一个班级可以同时容纳多个学生,学生与班级之间是()的关系。
    A、一对一
    B、一对多
    C 多对一
    D、多对多

    , i8 L6 Z2 N/ Z; ^
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|Java自学网

    GMT+8, 2024-3-5 23:24 , Processed in 0.104507 second(s), 34 queries .

    Powered by Javazx

    Copyright © 2012-2022, Javazx Cloud.

    快速回复 返回顶部 返回列表