Right Place For Right PersonTM 
Sponsored Ads
Home Tutorials Articles Forums Source Code Books Certifications Interviews Questions

Sun Java Certification Program 1.0 B

Section B
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2930

QUESTION NO: 81
Which determines if “prefs” is a directory and exists on the file system?
A. Boolean exists=Directory.exists (“prefs”);
B. Boolean exists=(new File(“prefs”)).isDir();
C. Boolean exists=(new Directory(“prefs”)).exists();
D. Boolean exists=(new File(“prefs”)).isDirectory();
E. Boolean exists=true;
Try{
Directory d = new Directory(“prefs”);
}
catch (FileNotFoundException e) {
exists = false;
}
Answer: D

QUESTION NO: 82
Which two create an InputStream and open file the “file.txt” for reading? (Choose Two)
A. InputStream in=new FileReader(“file.txt”);
B. InputStream in=new FileInputStream(“file.txt”);
C. InputStream in=new InputStreamFileReader (“file.txt”, “read”);
D. FileInputStream in=new FileReader(new File(“file.txt”));
E. FileInputStream in=new FileInputStream(new File(“file.txt”));

Answer: B, E

QUESTION NO 83
Which two construct an OutputSream that appends to the file “file.txt”? (Choose Two)
A. OutputStream out=new FileOutputStream(“file.txt”);
B. OutputStream out=new FileOutputStream(“file.txt”, “append”);
C. FileOutputStream out=new FileOutputStream(“file.txt”, true);
D. FileOutputStream out=new FileOutputStream(new file(“file.txt”));
E. OutputStream out=new FileOutputStream(new File(“file.txt”)true);

Answer: C, E

QUESTION NO: 84
Which constructs a BufferedIputStream?
A. New BufferedInputStream(“in.txt”);
B. New BufferedInputStream(new File(“in.txt”));
C. New BufferedInputStream(new Writer(“in.txt”));
D. New BufferedInputStream(new Writer(“in.txt”));
E. New BufferedInputStream(new InputStream(“in.txt”));
F. New BufferedInputStream(new FileInputStream(“in.txt”));

Answer: F

QUESTION NO: 85
Which is a valid identifier?
A. false
B. default
C. _object
D. a-class

Answer: C

QUESTION NO: 86
Exhibit:
1. package foo;
2.
3. import java.util.Vector;
4.
5. private class MyVector extends Vector {
6. int i = 1;
7. public MyVector() {
8. i = 2;
9. }
10. }
11.
12. public class MyNewVector extends MyVector {
13. public MyNewVector () {
14. i = 4;
15. }
16. public static void main (String args []) {
17. MyVector v = new MyNewVector();
18. }
19. }
The file MyNewVector.java is shown in the exhibit.
What is the result?
A. Compilation will succeed.
B. Compilation will fail at line 5.
C. Compilation will fail at line 6.
D. Compilation will fail at line 14.
E. Compilation will fail at line 17.

Answer: B

QUESTION NO: 87
Given:
1. public class Test {
2. public static void main (String[]args) {
3. String foo = args[1];
4. String bar = args[2];
5. String baz = args[3];
6. System.out.printIn(“baz = ” + baz);
7. }
8. }
And the output:
Baz = 2
Which command line invocation will produce the output?
A. Java Test 2222
B. Java Test 1 2 3 4
C. Java Test 4 2 4 2
D. Java Test 4 3 2 1

Answer: C

QUESTION NO: 88
Given:
8. int index = 1;
9. String [] test = new String[3];
10. String foo = test[index];
What is the result?
E. Foo has the value “”
B. Foo has the value null
C. An exception is thrown
D. The code will not compile

Answer: B

QUESTION NO: 89
Given:
1. public interface Foo{
2. int k = 4;
3. }
Which three are equivalent to line 2? (Choose Three)
A. Final int k = 4;
B. Public int k = 4;
C. Static int k = 4;
D. Private int k = 4;
E. Abstract int k = 4;
F. Volatile int k = 4;
G. Transient int k = 4;
H. Protected int k = 4;

Answer: A, B, C

QUESTION NO: 90
Given:
1. public class foo {
2. static String s;
3. public static void main (String[]args) {
4. system.out.printIn (“s=” + s);
5. }
6. }
What is the result?
A. The code compiles and “s=” is printed.
B. The code compiles and “s=null” is printed.
C. The code does not compile because string s is not initialized.
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is
called.

Answer: B

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2930

Interview Questions And Answers
Struts interview questions and answers (Subjective)
500 Java Objective Questions and Answer
Core Java Objective Questions And Answers
Core Java Subjective Questions And Answers
Core Java Interview Questions And Answers
Core Java Interview Questions and Answers (Subjective)
Core Java Interview Questions and Answers( Objective)
50 Servlet interview questions
155 Java Interview Questions
EJB Interview Questions and Answers(Subjective)
R4R,JSP Interview Questions and Answer(Subjective)
R4R,Java Servlets Interview Questions and Answers(Subjective)
Core Java Subjective ,Objective and Interview Questions And Answers
275 Core java interview questions
Java Objective Questions and Answer
Java Architect Interview Questions
Applet Interview Questions and Answers
Core Java example
Servlet Objective Questions And Answers
Servlet Subjective Questions And Answers
Servlet Interview Questions And Answers
JSP Objective Questions And Answers
JSP Subjective Questions And Answers
JSP Interview Questions And Answers

Contact US:

Your Name:


Your Email:

Message:

Comments:

Give Your Comments:


Advertiser PRIVACY POLICY ||User PRIVACY POLICY || R4R Group Srvices