SCJP试题-SCJPMockExam1

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



Q54
Which operators will always evaluate all the operands?

1) ||
2) +
3) &&
4) ? :
5) %

Q55
Which statements concerning the switch construct are true?

1) All switch statements must have a default label.
2) There must be exactly one label for each code segment in a switch statement.
3) The keyword continue can never occur within the body of a switch statement.
4) No case label may follow a default label within a single switch statement.
5) A character literal can be used as a value for a case label.

Q56
Which modifiers and return types would be valid in the declaration of a working main() method for a Java standalone application?

1) private
2) final
3) static
4) int
5) abstract

Q57
What will be the appearance of an applet with the following init() method?

public void init() {
add(new Button("hello"));
}

1) Nothing appears in the applet.
2) A button will cover the whole area of the applet.
3) A button will appear in the top left corner of the applet.
4) A button will appear, centered in the top region of the applet.
5) A button will appear in the center of the applet.

Q58
Which statements concerning the event model of the AWT are true?

1) At most one listener of each type can be registered with a component.
2) Mouse motion listeners can be registered on a List instance.
3) There exists a class named ContainerEvent in package java.awt.event.
4) There exists a class named MouseMotionEvent in package java.awt.event.
5) There exists a class named ActionAdapter in package java.awt.event.

Q59
Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?

1) FileOutputStream has no constructors matching the given arguments.
2) An IOExeception will be thrown if a file named "data" already exists.
3) An IOExeception will be thrown if a file named "data" does not already exist.
4) If a file named "data" exists, its contents will be reset and overwritten.
5) If a file named "data" exists, output will be appended to its current contents.

Q60
Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object.

class Base {
public void print() {
System.out.println("base");
}
}
class Extention extends Base {
public void print() {
System.out.println("extension");
// insert line of implementation here
}
}
public class Q294d {
public static void main(String args[]) {
Extention ext = new Extention();
ext.print();
}
}

Fill in a single line of implementation.



Q61
Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?

1) Vector filelist = ((Directory) file).getList();
2) String[] filelist = file.directory();
3) Enumeration filelist = file.contents();
4) String[] filelist = file.list();
5) Vector filelist = (new Directory(file)).files();

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

public class Q03e4 {
public static void main(String args[]) {
String space = " ";
String composite = space + "hello" + space + space;
composite.concat("world");
String trimmed = composite.trim();
System.out.println(trimmed.length());
}
}

1) 5
2) 6
3) 7
4) 12
5) 13

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答