SCJP试题-SCJPMockExam2

来源:java认证发布时间:2012-11-12 12:48:16java认证视频



Question 46)

Which of the following statements are true?

1) A method cannot be overloaded to be less public in a child class
2) To be overridden a method must have the same name and parameter types
3) To be overridden a method must have the same name, parameter and return types
4) An overridden method must have the same name, parameter names and parameter types



Answer to Question 46)


--------------------------------------------------------------------------------

Question 47)
What will happen when you attempt to compile and run the following code?

class Base{
Base(){
System.out.println("Base");
}
}

public class Checket extends Base{
public static void main(String argv[]){
Checket c = new Checket();
super();
}

Checket(){
System.out.println("Checket");
}
}
1) Compile time error
2) Checket followed by Base
3) Base followed by Checket
4) runtime error

Answer to Question 47)


--------------------------------------------------------------------------------

Question 48)
Which of the following statements are true?

1) Static methods cannot be overriden to be non static
2) Static methods cannot be declared as private
3) Private methods cannot be overloaded
4) An overloaded method cannot throw exceptions not checked in the base class

Answer to Question 48)


--------------------------------------------------------------------------------

Question 49)
Which of the following statements are true?

1) The automatic garbage collection of the JVM prevents programs from ever running out of memory
2) A program can suggest that garbage collection be performed but not force it
3) Garbage collection is platform independent
4) An object becomes eligible for garbage collection when all references denoting it are set to null.

Answer to Question 49)


--------------------------------------------------------------------------------

Question 50)
Given the following code

public class Sytch{

int x=2000;

public static void main(String argv[]){

System.out.println("Ms "+argv[1]+"Please pay $"+x);

}

}

What will happen if you attempt to compile and run this code with the command line

java Sytch Jones Diggle
1) Compilation and output of Ms Diggle Please pay $2000
2) Compile time error
3) Compilation and output of Ms Jones Please pay $2000
4) Compilation but runtime error

Answer to Question 50)


--------------------------------------------------------------------------------

Question 51)
What will happen when you attempt to compile and run the following code

class Base{
protected int i = 99;
}
public class Ab{
private int i=1;
public static void main(String argv[]){
Ab a = new Ab();
a.hallow();
}

abstract void hallow(){
System.out.println("Claines "+i);
}

}
1) Compile time error
2) Compilation and output of Claines 99
3) Compilation and output of Claines 1
4) Compilation and not output at runtime

Answer to Question 51)


--------------------------------------------------------------------------------

Question 52)
You have been asked to create a scheduling system for a hotel and catering organsiation.

You have been given the following information and asked to create a set of classes to represent it.

On the catering side of the organsiation they have

Head Chefs
Chefs
Apprentice Chefs

The system needs to store an employeeid, salary and the holiday entitlement

How would you best represent this information in Javae been given the following information and asked to create a set of classes to represent it.

On the catering side of the organsiation they have

Head Chefs
Chefs
Apprentice Chefs

The system needs to store an employeeid, salary and the holiday entitlement

How would you best represent this information in Java

1) Create classes for Head Chef, Chef, Apprentice Chef and store the other values in fields
2) Create an employee class and derive sub classes for Head Chef, Chef, Apprentice Chef and store the other values in fields.
3) Create and employee class with fields for Job title and fields for the other values.
4) Create classes for all of the items mentioned and create a container class to represent employees

Answer to Question 52)


视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答