电话:0731-83595998
导航

SCJP试题-SCJPMockExam1

来源: 2017-12-19 10:51

 百度广告

Q1 
1) an implementation of an abstraction. 
3) a category of objects. 
5) a blueprint for making operations.

Q2 

1) what classes are instantiated from. 
3) a blueprint for creating concrete realization of abstractions. 
5) a variable.

Q3 

public class Counter { // (1) 
public Counter(int startValue, int stepValue) { // (2) 
setStepValue(stepValue); 
public int get() { return current; } // (3) 
public void setStepValue(int stepValue) { step = stepValue; } // (5) 

1) Code marked with (1) is a constructor 
3) Code marked with (3) is a constructor 
5) Code marked with (5) is a Constructor

Q4 

Thing item, stuff; 
Thing entity = new Thing();

1) One object is created 
3) Three objects are created 
5) Two reference variables are created 
||| 
An instance member…

1) is also called a static member 
3) is never a method 
5) always represents an operation

Q6 

1) They pass messages by modifying each other's member variables 
3) They pass messages by calling each other's instance member methods 

Q7 

class A { 

int value2; 

1) Class A extends class B. 
3) Class A inherits from class B. 
5) Objects of class A have a member variable named value2.

Q8 

public class SmallProg { 
}

1) java SmallProg 
3) java SmallProg.java 
5) java SmallProg main

Q9 

public class Q6db8 { 
int b = 0; 
public void m() { 
int e = 0; 

1) a++; 
3) c++; 
5) e++;

Q10 
> and >>> operators?

1) For non-negative values of the left operand, the >> and >>> operators will have the same effect. 
> 1) is 0. 
>> 1) is -1. 
>> will never be negative as long as the value of the right operand is equal to or greater than 1. 
> operator, the leftmost bit of the bit representation of the resulting value will always be the same bit value as the leftmost bit of the bit representation of the left operand.

Q11 

class MyException extends Exception {}

public class Qb4ab { 
try { 
} finally { 
} catch (MyException e) {} 
public void bar() throws MyException { 

throw new RuntimeException(); 
}

1) Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause. 
3) An empty catch block is not allowed. 
5) A finally block must always follow one or more catch blocks. |||

Q12 

public class Qd803 { 
String word = "restructure"; 

1) est 
3) str 
5) s

Q13 

CODE BLOCK A: 
public void run() { 

Thread t = new Thread(r); 

CODE BLOCK B: 
public void start() { 

t.start();

CODE BLOCK C: 
public void run() { 

r.start();

CODE BLOCK D: 
t.start();

CODE BLOCK E: 
public void run() { 

t.run();

1) Code block A. 
3) Code block C. 
5) Code block E.

Q14 

Q15 
static int a; 
public Q275d() { 
c = a; 
b += c; 
public static void main(String args) { 

1) The code will fail to compile, since the constructor is trying to access static members. 
3) The code will fail to compile, since the constructor is trying to use member variable b before it has been initialized. 
5) The code will compile and run without any problems. |||

Q16 

public class Q63e3 { 
System.out.println(9 ^ 2); 
}

1) 81 
3) 11 
5) false

Q17 

1) Objects instantiated from Panel do not have a default layout manager. 
3) Objects instantiated from Applet have BorderLayout as default layout manager. 
5) Objects instantiated from Window have the same default layout manager as instances of Applet.

Q18 

1) public void main(String args) 
3) public static main(String argv) 
5) public static void main(String args)

Q19 

1) The method waitforId() in class MediaTracker is called. 
3) The call to the start() method of the Thread object returns. 
5) The wait() method is called on the Thread object.

Q20 

1) Collection 
3) SortedSet 

Q21 

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

Q22 

class Base { 
Base() { 

i += v; 
void print() { 

class Extension extends Base { 
add(2); 
void add(int v) { 

public class Qd073 { 
bogo(new Extension()); 
static void bogo(Base b) { 
b.print(); 
}

1) 9 
3) 20 
5) 22 |||

Q23 

public class Qf575 { 
}

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

Q24 

1) It affects which grid cell the components end up in. 
3) It affects the alignment of each component. 

Q25 

public class Q4a39 { 
int b = 1; 
class Inner { 
int get() { 
// insert statement here 

Q4a39() { 
System.out.println(i.get()); 
public static void main(String args) { 

1) c = b; 
3) c = this.b; 
5) c = c;

Q26 

public class Q76a9 { 
String a = "hello"; 
String c = b + "!"; // (1) 
b = a; // (2) 
return c; // (4) 
public static void main(String args) { 
System.out.println(msg); // (5) 
}

1) The line marked (1). 
3) The line marked (3). 
5) The line marked (5).

Q27 

1) The charAt() method of the String class. 
3) The replace() method of the String class. 
5) The length() method of the StringBuffer class.

Q28 

class A {} 
class C extends A {} 
public static void main(String args) { 
B y = new B(); 
// insert statement here 
}

1) x = y; 
3) y = (B) x; 
5) y = (A) y; |||

Q29 

1) default 
3) String 
5) long

Q30 

1) Mark the method with the keyword public. 
3) Mark the method with the keyword private. 
5) Do not mark the method with any accessibility modifiers.

Q31 

CODE FRAGMENT A: 
{ 0, 0, 0 }, 

编辑推荐:

下载Word文档

温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)

网络课程 新人注册送三重礼

已有 22658 名学员学习以下课程通过考试

网友评论(共0条评论)

请自觉遵守互联网相关政策法规,评论内容只代表网友观点!

最新评论

点击加载更多评论>>

精品课程

更多
10781人学习

免费试听更多

相关推荐
图书更多+
  • 电网书籍
  • 财会书籍
  • 其它工学书籍
拼团课程更多+
  • 电气拼团课程
  • 财会拼团课程
  • 其它工学拼团
热门排行

长理培训客户端 资讯,试题,视频一手掌握

去 App Store 免费下载 iOS 客户端