a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 98|回复: 0

[考试试题] JAVA认证历年真题:310-025精选题(13)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
37. What would be the result of attempting to compile and run the following piece of code?3 c4 w) y( L; D' w. w6 X% L) ^
public class Test {
" E* i5 ]) I  `( p6 {public static void main(String args[]){. R9 _2 J. q/ W2 `7 t" `% a$ s
int x;
5 M& M+ f, t$ k: a4 mSystem.out.println("Value is " + x);# {; W1 Y0 B1 y: g2 k" d, @' K7 Y  T
}
* H) c& c& C; D* A9 q}
# @5 J5 F7 ~" ?7 P, E4 SA. The output "Value is 0" is printed.
2 E1 E: G2 ~: V; C1 K) P& H& Q3 m: c0 `B. An object of type NullPointerException is thrown.' C4 |; ~2 ~$ D% F9 Q
C. An "illegal array declaration syntax" compiler error occurs.
6 K9 x* y  \7 u" j/ u0 FD. A "possible reference before assignment" compiler error occurs.+ B+ c  ]& N+ Q/ r
E. An object of type ArrayIndexOutOfBoundsException is thrown.
# f( T2 ]' s$ [% H5 _9 L( HD. Compiler says variable x might not have been initialized./ k. I  W, Z9 Y1 e- W7 [6 Y
38. What should you use to position a Button within an application Frame so that the size of the Button is NOT affected by the Frame size?
/ J+ v2 C: S( b( @/ P0 [) ?+ S$ KA. a FlowLayout
. Z% J  i" ~8 i5 X8 Z' }) @: x/ rB. a GridLayout( {+ }6 }& F) Z% }
C. the center area of a BorderLayout) }$ t0 }) M$ _5 d# n6 k
D. the East or West area of a BorderLayout7 h$ n1 [% q* D5 v5 V5 |
E. The North or South area of a BorderLayout. A2 T4 a/ A8 W
A.
* Z; B2 B' E) M1 L# a  C* tFor the following six questions you will be presented with a picture in the real test, showing the relationship and quite long text, but don't be afraid the questions are quite easy.
) I+ }' x2 t8 r; H, e* m3 O39. We have the following organization of classes.
: {+ ~: Z$ H# r! D6 iclass Parent {}
7 R% }# H9 |! N  R* jclass DerivedOne extends Parent {}7 L" ?8 i8 n& w, w, c; a+ A
class DerivedTwo extends Parent {}1 B4 R. y7 ^6 s. }( W, P: S+ c
Which of the following statements is correct for the following expression?' _* a8 r$ B+ y/ \% f$ R+ J
Parent p = new Parent();
% R" y5 Y/ P0 f3 ?( BDerivedOne d1 = new DerivedOne();$ Y5 a# [5 O: K8 Q; S5 z  z
DerivedTwo d2 = new DerivedTwo();
, x& ^1 `8 R, z3 D1 W5 H" ^p = d1;! I# V! W4 r3 l  g; M2 X
A. Illegal both at compile and runtime.
6 w, r* I( r. Y. T2 Z! q% [B. Legal at compile time, but may fail at runtime.' p4 H+ [3 Q# d8 x* d
C. Legal at both compile and runtime.
" N2 M1 q. E' T) K. i# O( V5 pD. ....
( B$ T9 q) G: T  {3 U" YE. ....
! @! C+ @  m3 _- XC.
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-6-2 16:12 , Processed in 0.196728 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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