分类信息
各地考试

当前位置:首页 » Java认证 » 模拟试题 » 正文

2014年Java认证SCJP模拟习题:SCJPMockExam(4)


时间:2013-10-31 来源:Java认证考试网 浏览次数:232  【华夏培训网:中国教育培训第一门户

Q21What does the value returned by the method getID() found in class java.awt.AWTEvent uniquely identify?1) The particu

Q21 
What does the value returned by the method getID() found in class java.awt.AWTEvent uniquely identify? 

1) The particular event instance. 
2) The source of the event. 
3) The set of events that were triggered by the same action. 
4) The type of event. 
5) The type of component from which the event originated. 

Q22 
What will be written to the standard output when the following program is run? 

class Base { 
int i; 
Base() { 
add(1); 
} 
void add(int v) { 
i += v; 
} 
void print() { 
System.out.println(i); 
} 
} 
class Extension extends Base { 
Extension() { 
add(2); 
} 
void add(int v) { 
i += v*2; 
} 
} 
public class Qd073 { 
public static void main(String args[]) { 
bogo(new Extension()); 
} 
static void bogo(Base b) { 
b.add(8); 
b.print(); 
} 
} 

1) 9 
2) 18 
3) 20 
4) 21 
5) 22

Q23 
Which lines of code are valid declarations of a native method when occurring within the declaration of the following class? 

public class Qf575 { 
// insert declaration of a native method here 
} 

1) native public void setTemperature(int kelvin); 
2) private native void setTemperature(int kelvin); 
3) protected int native getTemperature(); 
4) public abstract native void setTemperature(int kelvin); 
5) native int setTemperature(int kelvin) {} 

Q24 
How does the weighty property of the GridBagConstraints objects used in grid bag layout affect the layout of the components? 

1) It affects which grid cell the components end up in. 
2) It affects how the extra vertical space is distributed. 
3) It affects the alignment of each component. 
4) It affects whether the components completely fill their allotted display area vertically. 

Q25 
Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run? 

public class Q4a39 { 
int a = 1; 
int b = 1; 
int c = 1; 
class Inner { 
int a = 2; 
int get() { 
int c = 3; 
// insert statement here 
return c; 
} 
} 
Q4a39() { 
Inner i = new Inner(); 
System.out.println(i.get()); 
} 
public static void main(String args[]) { 
new Q4a39(); 
} 
} 

1) c = b; 
2) c = this.a; 
3) c = this.b; 
4) c = Q4a39.this.a; 





        Java认证

推荐图文

热门点击排行

©2015 hxpx.com All Rights Reserved 滇ICP备13002816号-1
华夏培训网唯一网址www.hxpx.com