java自学网VIP

Java自学网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4496|回复: 0

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

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

    [LV.Master]出神入化

    2025

    主题

    3683

    帖子

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    66345

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

    发表于 2016-7-27 14:23:29 | 显示全部楼层 |阅读模式
    java软件工程师笔试题目(III)
             
    规则:
    1. 时间:40分钟
    2. 个人独立完成,不能使用手机等上网上查询。如果被发现作弊,则零分。
    3. 为了环保和节约纸张,在答题卡上填写答案
    一、不定项选择题(每题5分)
    Question 1
    Given:
    11. public class Test {
    : j4 I5 T! S9 ]5 X# d: E' \* f8 X12. public static void main(String [] args) {
    ' q# ?9 T3 q* U1 c% ]3 J13. int x =5; & X  _6 {1 F9 m
    14. boolean b1 = true; 6 t6 N4 ?) n, V
    15. boolean b2 = false;  
    1 b) n$ D5 U! U( u$ u+ H$ d: ^0 h* l17.if((x==4) && !b2) ' ~( _& o/ v  U1 D4 j/ g
    18. System.out.print(”l “);
    " ]2 |; Y7 ^9 f  K" X: l  P19. System.out.print(”2 “);
    * d* i4 P! Q& x/ L20. if ((b2 = true) && b1)  7 `8 l4 ?* T: U, g) Y/ x
    21. System.out.print(”3 “);
    8 n2 l9 L! k' ?' [3 ?' O9 A22. } $ d3 n! H6 U  ~. q  m  W
    23. }
    4 S' D1 ~! h  y: q+ ?What is the result?
    6 w, H$ S  D1 u# TA. 2 $ d9 V% p0 T+ d: k6 w6 H
    B. 3
    1 M1 d+ l& m; m( G) uC. 1 2
    / A" V, _: H7 ^) t& @D. 2 3 3 N$ s" L, R5 p* L* v* h  d  Z- T7 m
    E. 1 2 3 , B$ b4 u! }  b# V9 A
    F. Compilation fails. # n; @  k$ n1 ?9 b2 O9 X
    G. Au exceptional is thrown at runtime.
    Question 2
    Assume that country is set for each class.
    Given:
    10. public class Money {
    7 `' A  v9 Y. W( p  J( V0 a' I11. private String country, name; ( F4 Y' l( P3 B; ^4 c  `$ a/ x
    12. public String getCountry() { return country; }
    ' o% z: Y3 y$ v! @$ _. @! K13.}
    and:
    24. class Yen extends Money {
    2 ]) }# B! L$ D1 t/ z25. public String getCountry() { return super.country; }
    , ^7 b2 L  V9 y- ~26. }
    - D8 W0 }2 V( Y/ \27.
    / ~/ ^0 S$ y! u* [2 y+ e% l28. class Euro extends Money { 5 D! v& A4 c- q: F
    29. public String getCountry(String timeZone) {
    - i+ Q1 l- ?& I, u30. return super.getCountry();
    - F. }1 Z5 U% a0 @6 z& Q: t7 d31. } $ I9 e% n  V4 f7 u; g( n% X
    32. } ( ?4 `7 G) ]/ y3 G9 z! D3 T
    Which two are correct? (Choose two.)
    A. Yen returns correct values. 7 [" T: T" A8 |$ M0 R1 m# A
    B. Euro returns correct values.
    - I- s* L# y. ZC. An exception is thrown at runtime.
    0 W2 i0 V) U5 Y7 gD. Yen and Euro both return correct values. ( V6 F- H7 i3 ~$ d7 l  s
    E. Compilation fails because of an error at line 25. 9 h0 f* n# b$ k! L$ _; T
    F. Compilation fails because of an error at line 30.
    Question 3
    Given:
    1. class TestA {
    & z4 l( `' g! b1 s5 d- s2. public void start() { System.out.println(”TestA”); }
    ' D! y1 D& Q  W9 h2 l- ~+ P3. }
    ; T" f. P+ f$ C7 @4. public class TestB extends TestA { 2 M7 a$ U; ]2 m
    5. public void start() { System.out.println(”TestB”); } 5 a  |+ [  |) y* D! e
    6. public static void main(String[] args) {     , ~. r- i+ Z3 Z* k; p( P
    7. ((TestA)new TestB()).start(); 2 D4 d, e; s  J! n, \
    8. }
    0 N' D2 [3 M4 s" o  N9. }   n4 d- Y% |2 H" T8 O
    What is the result?
    A. TestA
    ; W& H$ I( Q) `& s1 M, d. ]/ NB. TestB
    ! i! o* R" N# ~. TC. Compilation fails.
    - p& t8 J4 _% V0 {D. An exception is thrown at runtime.
    Question 4
    Given:
    11. public static void main(String[] args) {
    4 ]( Z4 L; I" q9 C6 A/ K12. String str = “null’; + g, I/ Q; ?( q  d% ]# n9 ^/ I, O  ?
    13. if (str == null) {     
    / ]8 [4 P0 Q2 |14. System.out.println(”null”);
    ! J+ U4 G1 \. t# T15. } else (str.length() == 0) {   
    8 h+ m' |' a6 B9 {16. System.out.println(”zero”);
    / V5 C% B, O4 u! r0 k  U17. } else {
    ) }% X6 K: `& |( m. \' S' ]18. System.out.println(”some”); 5 ~$ I* X, Y" o: ]' t1 e' N
    19. } ' B7 J! m5 D4 f+ w; V  E: n* o. }+ ^
    20. }
    " x4 J' |/ p( K* e0 c2 k) Z‘What is the result?
    A. null
    / J8 e- B7 |" ^5 s, pB. zero 5 K" T0 ]7 K' g/ M( T5 H
    C. some
    ; M' F! c+ y6 Y$ a& kD. Compilation fails.
    ! z3 j/ m! @5 n; \E. An exception is thrown at runtime.
    Question 5
    Given:
    33. try {
    + w) J, J, f& ]0 |$ ]7 d34. // some code here / R2 `7 P: v/ T3 S+ _% D: v
    35. } catch (NullPointerException e1) { $ Y/ a3 h2 L) E3 ^$ J# R1 T/ Y
    36. System.out.print(”a”); 1 x* b. x/ G( H# v
    37. } catch (RuntimeException e2) { 5 p# h3 _  }# I! u9 j! ~
    38. System.out.print(”b”);
    * g) v. \# j) u( M, r39. } finally { - X$ b3 n/ Y! {9 A
    40. System.out.print(”c”); 1 f$ a. q1 y7 t
    41. }
    & f# k" f* j$ Q9 ^, rWhat is the result if a NullPointerException occurs on line 34? 6 Y, a4 L) z; K, a9 v4 X
    A. c
    % T: b) ]* X% C1 H2 h* y5 N1 gB. a % E& J( R8 b$ f* W
    C. ab
    + ]# n. S, |( Q( f" u# cD. ac : k( X/ X& P; r: A2 K; S( K
    E. bc , o- m. W( p# B7 @, [) p0 {. [4 h; c
    F. abc
    Question 6
    Given this method in a class:
    21. public String toString() {
    0 c8 C2 i+ ~/ m* c+ j; k22. StringBuffer buffer = new StringBuffer();
      E$ w! x7 |6 o& j- Q; S  h23. buffer.append(’<’);   R# a4 A) k# O
    24. buffer.append(this.name); & `4 @: S/ G1 o: m1 t/ T5 W0 j0 E
    25. buffer.append(’>’); 1 J& \/ f$ o4 M& ^; X
    26. return buffer.toString(); - S7 L: M$ E. O7 H" b. p2 _
    27. }
    % b# y/ J; }" z) D0 m: xWhich is true?
    A. This code is NOT thread-safe.
    / V( R3 E% j7 c) [# l: O( x3 nB. The programmer can replace StringBuffer with StringBuilder with no
    0 l0 A, U5 ?. _# z( G% cother changes.
    ; E$ \4 o( S* U, MC. This code will perform well and converting the code to use & {$ W" a3 O/ E
    StringBuilder will not enhance the performance. 8 k* G& [& O1 \! K, o. K/ W
    D. This code will perform poorly. For better performance, the code 1 k5 y" m/ s$ y4 ]& B
    should be rewritten: return “<“+ this.name + “>”;
    Question 7
    Given:
    11. String test= “a1b2c3”;
    + p/ k7 B, j9 O5 @, B& E" S$ E12. String[] tokens = test.split(”\\d”);  
    ) H; D8 G5 ~( G6 \6 i3 n3 e& q6 }. d13. for(String s: tokens) System.out.print(s +“ “); 3 x' i' N6 R  _& `( X) z6 H
    What is the result?
    9 e# c& m/ D. ?3 x8 iA. a b c
    5 A1 x8 P9 v1 P8 h7 v3 z  F: Z7 hB. 1 2 3
    ! n9 u7 Q( K4 W, zC. a1b2c3 , v/ K6 r3 V/ e, x0 Y' g8 x
    D. a1 b2 c3
    7 a0 m, A) O. u- N+ kE. Compilation fails. ! A0 K+ P" Z8 _5 q/ f
    F. The code runs with no output.
    & r1 [. V- _( f7 tG. 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、多对多
    8 ?: B/ p; v$ R$ `# F+ [) k
    回复

    使用道具 举报

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

    本版积分规则

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

    GMT+8, 2024-11-21 17:49 , Processed in 0.118336 second(s), 31 queries .

    Powered by Javazx

    Copyright © 2012-2022, Javazx Cloud.

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